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)
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))
def _on_socket_opened(self, topic): self._board.publish(MessageSendConnect, ConnectMessage('pre2', session=self._session))
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)
def test_repr(self): m1 = ConnectMessage(self.version, support=self.support, session=self.session) m2 = eval(repr(m1)) self.assertEqual(m1, m2)
def test_invalid_support(self): with self.assertRaises(ValueError): ConnectMessage(self.version, support=[])