test_outgoing_message.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 import rostest
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 class TestOutgoingMessage(unittest.TestCase):
11  def test_json_values(self):
12  msg = String(data="foo")
13  outgoing = OutgoingMessage(msg)
14 
15  result = outgoing.get_json_values()
16  self.assertEqual(result['data'], msg.data)
17 
18  again = outgoing.get_json_values()
19  self.assertTrue(result is again)
20 
21  def test_cbor_values(self):
22  msg = String(data="foo")
23  outgoing = OutgoingMessage(msg)
24 
25  result = outgoing.get_cbor_values()
26  self.assertEqual(result['data'], msg.data)
27 
28  again = outgoing.get_cbor_values()
29  self.assertTrue(result is again)
30 
31 
32 PKG = 'rosbridge_library'
33 NAME = 'test_outgoing_message'
34 if __name__ == '__main__':
35  rostest.unitrun(PKG, NAME, TestOutgoingMessage)


rosbridge_library
Author(s): Jonathan Mace
autogenerated on Wed Jun 3 2020 03:55:14