예제 #1
0
 def test_with_support_with_session(self):
     message = ConnectMessage(self.version,
                              support=self.support,
                              session=self.session)
     self.assertEqual(message.version, self.version)
     self.assertEqual(message.support, self.support)
     self.assertTrue(message.has_session())
     self.assertEqual(message.session, self.session)
예제 #2
0
 def test_equality(self):
     m1 = ConnectMessage(self.version, support=self.support, session='a')
     m2 = ConnectMessage(self.version, support=self.support, session='a')
     m3 = ConnectMessage(self.version, support=self.support, session='b')
     self.assertEqual(m1, m1)
     self.assertEqual(m1, m2)
     self.assertNotEqual(m1, m3)
     self.assertNotEqual(m1, object())
 def test_without_support_with_session(self):
     message = self.parser.parse({
         'msg': 'connect',
         'version': self.version,
         'session': self.session
     })
     self.assertEqual(message,
                      ConnectMessage(self.version, session=self.session))
예제 #4
0
 def _on_socket_opened(self, topic):
     self._board.publish(MessageSendConnect,
                         ConnectMessage('pre2', session=self._session))
예제 #5
0
 def test_without_support_without_session(self):
     message = ConnectMessage(self.version)
     self.assertEqual(message.version, self.version)
     self.assertEqual(message.support, [self.version])
     self.assertFalse(message.has_session())
     self.assertIsNone(message.session)
예제 #6
0
 def test_repr(self):
     m1 = ConnectMessage(self.version,
                         support=self.support,
                         session=self.session)
     m2 = eval(repr(m1))
     self.assertEqual(m1, m2)
예제 #7
0
 def test_invalid_support(self):
     with self.assertRaises(ValueError):
         ConnectMessage(self.version, support=[])
예제 #8
0
 def test_without_support_without_session(self):
     message = ConnectMessage(self.version)
     self.assertEqual(message.version, self.version)
     self.assertEqual(message.support, [self.version])
     self.assertFalse(message.has_session())
     self.assertIsNone(message.session)
예제 #9
0
 def test_with_support_with_session(self):
     message = ConnectMessage(self.version, support=self.support, session=self.session)
     self.assertEqual(message.version, self.version)
     self.assertEqual(message.support, self.support)
     self.assertTrue(message.has_session())
     self.assertEqual(message.session, self.session)