예제 #1
0
 def test_pingd(self):
     packet = PingD(data='test_data')
     serialized_packet = packet.pack()
     self.socket.sendall(serialized_packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, PongD)
     self.assertEqual(packet.data, reply.data)
예제 #2
0
 def test_finish(self):
     packet = Finish().pack()
     self.socket.sendall(packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, AckFinish)
     self.server.wait(timeout=self.TERMINATE_TIMEOUT)
     self.assertTrue(self.server.poll() is not None)
예제 #3
0
 def test_pingd(self):
     packet = PingD(data='test_data')
     serialized_packet = packet.pack()
     self.socket.sendall(serialized_packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, PongD)
     self.assertEqual(packet.data, reply.data)
예제 #4
0
 def test_finish(self):
     packet = Finish().pack()
     self.socket.sendall(packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, AckFinish)
     self.server.wait(timeout=self.TERMINATE_TIMEOUT)
     self.assertTrue(self.server.poll() is not None)
예제 #5
0
 def test_finish(self):
     packet = Finish().pack()
     self.socket.sendall(packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, AckFinish)
     while True:
         if not os.path.exists(self.PID_FILE):
             time.sleep(0.5)
             break
     self.assertTrue(self.server.poll() is not None)
예제 #6
0
 def test_quit(self):
     packet = Quit().pack()
     self.socket.sendall(packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, AckQuit)
     self.assertTrue(hasattr(reply, 'session'))
예제 #7
0
 def test_ping(self):
     packet = Ping().pack()
     self.socket.sendall(packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, Pong)
예제 #8
0
 def test_connect(self):
     packet = Connect().pack()
     self.socket.sendall(packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, Connected)
     self.assertTrue(hasattr(reply, 'session'))
예제 #9
0
 def test_quit(self):
     packet = Quit().pack()
     self.socket.sendall(packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, AckQuit)
     self.assertTrue(hasattr(reply, 'session'))
예제 #10
0
 def test_ping(self):
     packet = Ping().pack()
     self.socket.sendall(packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, Pong)
예제 #11
0
 def test_connect(self):
     packet = Connect().pack()
     self.socket.sendall(packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, Connected)
     self.assertTrue(hasattr(reply, 'session'))