Пример #1
0
 def test_returns_set_of_hosts_from_sources(self):
     sources, _ = make_sources()
     hosts = set()
     for source in sources:
         # Use the source to obtain the hosts and add it to a list.
         host = urlparse(source["url"]).hostname
         hosts.add(host)
         # If the host is an IPv6 address, add an extra fixed IPv6
         # with brackets.
         if ":" in host:
             hosts.add("[%s]" % host)
     self.assertItemsEqual(hosts, get_hosts_from_sources(sources))
Пример #2
0
 def test__returns_set_of_hosts_from_sources(self):
     sources, hosts = make_sources()
     self.assertItemsEqual(hosts, get_hosts_from_sources(sources))