def test_unpack(self): packet = Packet.unpack(b'3') self.assertEqual(Quit, type(packet)) self.assertEqual(QUIT, packet.command)
def test_unpack(self): packet = Packet.unpack(b'2hello world') self.assertEqual(PingD, type(packet)) self.assertEqual(PINGD, packet.command) self.assertEqual('hello world', packet.data)
def test_unpack(self): packet = Packet.unpack(b'1') self.assertEqual(Ping, type(packet)) self.assertEqual(PING, packet.command)
def test_unpack(self): packet = Packet.unpack(b'0') self.assertEqual(Connect, type(packet)) self.assertEqual(CONNECT, packet.command)
def test_unpack(self): packet = Packet.unpack(b'5') self.assertEqual(Finish, type(packet)) self.assertEqual(FINISH, packet.command)
def test_unpack(self): packet = Packet.unpack(b'4hello world') self.assertEqual(QuitD, type(packet)) self.assertEqual(QUITD, packet.command) self.assertEqual('hello world', packet.data)