示例#1
0
 def tearDown(self):
     self.srv.kill()
     # euthanize the server
     try:
         query_server('', 'localhost', 58998)
     except:
         pass
示例#2
0
 def test_udp_200_OK(self):
     port = self.port
     expected = '+481234,+481299,sip.freeconet.pl,freeconet'
     # test edges of range
     result = query_server('+481234', 'localhost', port, timeout=5).rsplit(',', 2)[0]
     self.assertEqual(expected, result)
     result = query_server('+481299', 'localhost', port).rsplit(',', 2)[0]
     self.assertEqual(expected, result)
     # test inside of range
     for n in range(481235, 481299, 10):
         result = query_server('+'+str(n), 'localhost', port) \
                     .rsplit(',', 2)[0]
         self.assertEqual(expected, result)
示例#3
0
 def test_udp_404(self):
     port = self.port
     self.assertEqual(None, query_server('+481300', 'localhost', port))
     self.assertEqual(None, query_server('+481199', 'localhost', port))
     self.assertEqual(None, query_server('+4810000', 'localhost', port))
     self.assertEqual(None, query_server('+1', 'localhost', port))