def test_create_server_class_invalid_server_type(self): server_type = 'fake_server_type' protocol = 'TCP' port = 12345 source = '1.2.3.4' try: create_server_class(protocol, port, source, server_type) except ValueError: pass
def test_create_tcp_server_class(self): protocol = 'TCP' port = 12345 source = '1.2.3.4' server_class, args, kwargs = create_server_class( protocol, port, source) self.assertEqual(server_class, ThreadedTCPServer)
def test_create_iperf_tcp_server_class(self): server_type = 'iperf' protocol = 'TCP' port = 12345 source = '1.2.3.4' server_class, args, kwargs = create_server_class( protocol, port, source, server_type) self.assertEqual(server_class, IperfServer)
def test_create_udp_V6_server_class(self): protocol = 'UDP' port = 12345 source = '::4' server_class, args, kwargs = create_server_class( protocol, port, source) self.assertEqual(server_class, ThreadedUDPServerV6) self.assertEqual(server_class.address_family, socket.AF_INET6)