def test_get_proxies_with_http_proxy_set(self):
        # Disable boot source cache signals.
        self.addCleanup(bootsources.signals.enable)
        bootsources.signals.disable()

        url = factory.make_parsed_url()
        yield deferToDatabase(self.set_http_proxy, url.geturl())

        response = yield call_responder(Region(), GetProxies, {})

        self.assertEqual({"http": url, "https": url}, response)
Beispiel #2
0
    def test_get_archive_mirrors_with_ports_archive_set(self):
        ports_archive = yield deferToDatabase(
            lambda: PackageRepository.get_ports_archive())
        url = factory.make_parsed_url(scheme='http')
        ports_archive.url = url.geturl()
        yield deferToDatabase(transactional(ports_archive.save))

        response = yield call_responder(Region(), GetArchiveMirrors, {})

        self.assertEqual(
            {"main": urlparse("http://archive.ubuntu.com/ubuntu"),
             "ports": url},
            response)