Ejemplo n.º 1
0
class SubMessageParserTestCase(unittest.TestCase):
    def setUp(self):
        self.parser = SubMessageParser()
        self.id = 'id'
        self.name = 'name'
        self.params = ['param1', True, 1.0]

    def _make_pod(self, **kwargs):
        pod = {'msg': 'sub', 'id': self.id, 'name': self.name}
        pod.update(kwargs)
        return pod

    def _make_message(self, **kwargs):
        return SubMessage(self.id, self.name, **kwargs)

    def test_with_params(self):
        kwargs = {'params': self.params}
        message = self.parser.parse(self._make_pod(**kwargs))
        self.assertEqual(message, self._make_message(**kwargs))

    def test_without_params(self):
        message = self.parser.parse(self._make_pod())
        self.assertEqual(message, self._make_message())
Ejemplo n.º 2
0
class SubMessageParserTestCase(unittest.TestCase):
    def setUp(self):
        self.parser = SubMessageParser()
        self.id = 'id'
        self.name = 'name'
        self.params = ['param1', True, 1.0]

    def _make_pod(self, **kwargs):
        pod = {'msg': 'sub', 'id': self.id, 'name': self.name}
        pod.update(kwargs)
        return pod

    def _make_message(self, **kwargs):
        return SubMessage(self.id, self.name, **kwargs)

    def test_with_params(self):
        kwargs = {'params': self.params}
        message = self.parser.parse(self._make_pod(**kwargs))
        self.assertEqual(message, self._make_message(**kwargs))

    def test_without_params(self):
        message = self.parser.parse(self._make_pod())
        self.assertEqual(message, self._make_message())
Ejemplo n.º 3
0
 def setUp(self):
     self.parser = SubMessageParser()
     self.id = 'id'
     self.name = 'name'
     self.params = ['param1', True, 1.0]
Ejemplo n.º 4
0
 def setUp(self):
     self.parser = SubMessageParser()
     self.id = 'id'
     self.name = 'name'
     self.params = ['param1', True, 1.0]