コード例 #1
0
 def test_run_import_sets_proxy_for_loopback(self):
     fake = self.patch_boot_resources_function()
     _run_import(sources=[], maas_url=factory.make_simple_http_url())
     self.assertEqual(
         fake.env["no_proxy"],
         ("localhost,::ffff:127.0.0.1,127.0.0.1,::1,"
          "[::ffff:127.0.0.1],[::1]"),
     )
コード例 #2
0
 def test__run_import_sets_proxy_if_given(self):
     proxy = 'http://%s.example.com' % factory.make_name('proxy')
     fake = self.patch_boot_resources_function()
     _run_import(sources=[],
                 maas_url=factory.make_simple_http_url(),
                 http_proxy=proxy,
                 https_proxy=proxy)
     self.expectThat(fake.env['http_proxy'], Equals(proxy))
     self.expectThat(fake.env['https_proxy'], Equals(proxy))
コード例 #3
0
 def test__run_import_sets_proxy_for_source_host(self):
     host = factory.make_name("host").lower()
     maas_url = "http://%s/" % host
     sources, _ = make_sources()
     fake = self.patch_boot_resources_function()
     _run_import(sources=sources, maas_url=maas_url)
     self.assertItemsEqual(
         fake.env['no_proxy'].split(','),
         ["localhost", "::ffff:127.0.0.1", "127.0.0.1", "::1"] + [host])
コード例 #4
0
ファイル: test_boot_images.py プロジェクト: uraniid/maas
 def test__run_import_integrates_with_boot_resources_function(self):
     # If the config specifies no sources, nothing will be imported.  But
     # the task succeeds without errors.
     fixture = self.useFixture(BootSourcesFixture([]))
     self.patch(boot_resources, 'logger')
     self.patch(boot_resources,
                'locate_config').return_value = (fixture.filename)
     self.assertThat(_run_import(sources=[]), Is(False))
コード例 #5
0
 def test_run_import_integrates_with_boot_resources_function(self):
     # If the config specifies no sources, nothing will be imported.  But
     # the task succeeds without errors.
     fixture = self.useFixture(BootSourcesFixture([]))
     self.patch(boot_resources, "logger")
     self.patch(boot_resources,
                "locate_config").return_value = fixture.filename
     self.assertThat(
         _run_import(sources=[], maas_url=factory.make_simple_http_url()),
         Is(False),
     )
コード例 #6
0
 def test_run_import_calls_reload_boot_images(self):
     fake_reload = self.patch(boot_images, "reload_boot_images")
     self.patch(boot_resources, "import_images")
     sources, _ = make_sources()
     _run_import(sources=sources, maas_url=factory.make_simple_http_url())
     self.assertThat(fake_reload, MockCalledOnceWith())
コード例 #7
0
 def test_run_import_accepts_sources_parameter(self):
     fake = self.patch(boot_resources, "import_images")
     sources, _ = make_sources()
     _run_import(sources=sources, maas_url=factory.make_simple_http_url())
     self.assertThat(fake, MockCalledOnceWith(sources))
コード例 #8
0
 def test_run_import_sets_GPGHOME(self):
     home = factory.make_name("home")
     self.patch(boot_images, "get_maas_user_gpghome").return_value = home
     fake = self.patch_boot_resources_function()
     _run_import(sources=[], maas_url=factory.make_simple_http_url())
     self.assertEqual(home, fake.env["GNUPGHOME"])
コード例 #9
0
ファイル: test_boot_images.py プロジェクト: uraniid/maas
 def test__run_import_calls_reload_boot_images(self):
     fake_reload = self.patch(boot_images, 'reload_boot_images')
     self.patch(boot_resources, 'import_images')
     sources, _ = make_sources()
     _run_import(sources=sources)
     self.assertThat(fake_reload, MockCalledOnceWith())
コード例 #10
0
ファイル: test_boot_images.py プロジェクト: uraniid/maas
 def test__run_import_accepts_sources_parameter(self):
     fake = self.patch(boot_resources, 'import_images')
     sources, _ = make_sources()
     _run_import(sources=sources)
     self.assertThat(fake, MockCalledOnceWith(sources))
コード例 #11
0
ファイル: test_boot_images.py プロジェクト: uraniid/maas
 def test__run_import_sets_proxy_for_loopback(self):
     fake = self.patch_boot_resources_function()
     _run_import(sources=[])
     self.assertEqual(fake.env['no_proxy'],
                      "localhost,::ffff:127.0.0.1,127.0.0.1,::1")
コード例 #12
0
ファイル: test_boot_images.py プロジェクト: uraniid/maas
 def test__run_import_sets_GPGHOME(self):
     home = factory.make_name('home')
     self.patch(boot_images, 'get_maas_user_gpghome').return_value = home
     fake = self.patch_boot_resources_function()
     _run_import(sources=[])
     self.assertEqual(home, fake.env['GNUPGHOME'])