def test_load_addresses_with_duplicate_addresses(self):
     self.network_config.addresses.append("192.168.0.1:5701")
     self.network_config.addresses.append("192.168.0.1:5701")
     provider = DefaultAddressProvider(self.network_config)
     addresses = provider.load_addresses()
     six.assertCountEqual(self, addresses, [Address("192.168.0.1", 5701),
                                            Address("192.168.0.1", 5701)])
예제 #2
0
 def test_load_addresses_without_port(self):
     initial_list = ["192.168.0.1"]
     provider = DefaultAddressProvider(initial_list)
     primaries, secondaries = provider.load_addresses()
     self.assertCountEqual(primaries, [Address("192.168.0.1", 5701)])
     self.assertCountEqual(
         secondaries,
         [Address("192.168.0.1", 5702),
          Address("192.168.0.1", 5703)])
예제 #3
0
 def test_load_addresses_with_empty_addresses(self):
     initial_list = []
     provider = DefaultAddressProvider(initial_list)
     primaries, secondaries = provider.load_addresses()
     self.assertCountEqual(primaries, [Address("127.0.0.1", 5701)])
     self.assertCountEqual(
         secondaries,
         [Address("127.0.0.1", 5702),
          Address("127.0.0.1", 5703)])
예제 #4
0
 def test_load_addresses_with_duplicate_addresses(self):
     initial_list = ["192.168.0.1:5701", "192.168.0.1:5701"]
     provider = DefaultAddressProvider(initial_list)
     primaries, secondaries = provider.load_addresses()
     self.assertCountEqual(
         primaries,
         [Address("192.168.0.1", 5701),
          Address("192.168.0.1", 5701)])
     self.assertCountEqual(secondaries, [])
 def test_load_addresses_with_multiple_addresses(self):
     initial_list = [
         "192.168.0.1:5701", "192.168.0.1:5702", "192.168.0.2:5701"
     ]
     provider = DefaultAddressProvider(initial_list)
     primaries, secondaries = provider.load_addresses()
     six.assertCountEqual(self, primaries, [
         Address("192.168.0.1", 5701),
         Address("192.168.0.1", 5702),
         Address("192.168.0.2", 5701)
     ])
     six.assertCountEqual(self, secondaries, [])
 def test_load_addresses_with_empty_addresses(self):
     provider = DefaultAddressProvider(self.network_config)
     addresses = provider.load_addresses()
     six.assertCountEqual(self, addresses, [])