コード例 #1
0
 def test_hostname_with_port_path_and_protocol(self):
     """get_host_from_address returns hostname for hostname with port and path"""
     result = get_host_from_address('https://hostname:8888/somewhere/else/')
     self.assertEqual(result, 'hostname')
コード例 #2
0
 def test_hostname_with_port(self):
     """get_host_from_address returns hostname for hostname with port"""
     result = get_host_from_address('hostname:8888')
     self.assertEqual(result, 'hostname')
コード例 #3
0
 def test_hostname_with_trailing_slash(self):
     """get_host_from_address returns hostname for hostname with trailing slash"""
     result = get_host_from_address('//hostname')
     self.assertEqual(result, 'hostname')
コード例 #4
0
 def test_hostname(self):
     """get_host_from_address returns hostname unchanged"""
     result = get_host_from_address('hostname')
     self.assertEqual(result, 'hostname')
コード例 #5
0
 def test_empty_string(self):
     """get_host_from_address returns None for empty string"""
     result = get_host_from_address('')
     self.assertIsNone(result)
コード例 #6
0
 def test_none(self):
     """get_host_from_address returns None for None"""
     result = get_host_from_address(None)
     self.assertIsNone(result)