test_outgoing_message.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 import rosunit
3 import sys
4 import unittest
5 
6 from rosbridge_library.internal.outgoing_message import OutgoingMessage
7 from std_msgs.msg import String
8 
9 
10 PKG = 'rosbridge_library'
11 NAME = 'test_outgoing_message'
12 
13 
14 class TestOutgoingMessage(unittest.TestCase):
15  def test_json_values(self):
16  msg = String(data="foo")
17  outgoing = OutgoingMessage(msg)
18 
19  result = outgoing.get_json_values()
20  self.assertEqual(result['data'], msg.data)
21 
22  again = outgoing.get_json_values()
23  self.assertTrue(result is again)
24 
25  def test_cbor_values(self):
26  msg = String(data="foo")
27  outgoing = OutgoingMessage(msg)
28 
29  result = outgoing.get_cbor_values()
30  self.assertEqual(result['data'], msg.data)
31 
32  again = outgoing.get_cbor_values()
33  self.assertTrue(result is again)
34 
35 
36 if __name__ == '__main__':
37  rosunit.unitrun(PKG, NAME, TestOutgoingMessage)


rosbridge_library
Author(s): Jonathan Mace
autogenerated on Fri Oct 21 2022 02:45:18