Merge lp:~jtv/maas/import-boot-images-with-mandatory-sources into lp:~maas-committers/maas/trunk

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: no longer in the source branch.
Merged at revision: 2367
Proposed branch: lp:~jtv/maas/import-boot-images-with-mandatory-sources
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 44 lines (+5/-5)
1 file modified
src/provisioningserver/tests/test_tasks.py (+5/-5)
To merge this branch: bzr merge lp:~jtv/maas/import-boot-images-with-mandatory-sources
Reviewer Review Type Date Requested Status
Jeroen T. Vermeulen (community) Approve
Review via email: mp+220993@code.launchpad.net

This proposal supersedes a proposal from 2014-05-26.

Commit message

Prepare tests for import_boot_images task taking a mandatory sources argument. Extracted from larger branch to reduce review size.

To post a comment you must log in.
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

No point waiting for this, really; it's a tiny change and tests would break if it were wrong. Self-approving.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/provisioningserver/tests/test_tasks.py'
--- src/provisioningserver/tests/test_tasks.py 2014-05-26 13:19:43 +0000
+++ src/provisioningserver/tests/test_tasks.py 2014-05-26 16:17:24 +0000
@@ -646,21 +646,21 @@
646 self.patch(boot_resources, 'logger')646 self.patch(boot_resources, 'logger')
647 self.patch(boot_resources, 'locate_config').return_value = (647 self.patch(boot_resources, 'locate_config').return_value = (
648 fixture.filename)648 fixture.filename)
649 import_boot_images()649 import_boot_images(sources=[])
650 self.assertIsInstance(import_boot_images, Task)650 self.assertIsInstance(import_boot_images, Task)
651651
652 def test_import_boot_images_sets_GPGHOME(self):652 def test_import_boot_images_sets_GPGHOME(self):
653 home = factory.make_name('home')653 home = factory.make_name('home')
654 self.patch(tasks, 'MAAS_USER_GPGHOME', home)654 self.patch(tasks, 'MAAS_USER_GPGHOME', home)
655 fake = self.patch_boot_resources_function()655 fake = self.patch_boot_resources_function()
656 import_boot_images()656 import_boot_images(sources=[])
657 self.assertEqual(home, fake.env['GNUPGHOME'])657 self.assertEqual(home, fake.env['GNUPGHOME'])
658658
659 def test_import_boot_images_sets_proxy_if_given(self):659 def test_import_boot_images_sets_proxy_if_given(self):
660 proxy = 'http://%s.example.com' % factory.make_name('proxy')660 proxy = 'http://%s.example.com' % factory.make_name('proxy')
661 proxy_vars = ['http_proxy', 'https_proxy']661 proxy_vars = ['http_proxy', 'https_proxy']
662 fake = self.patch_boot_resources_function()662 fake = self.patch_boot_resources_function()
663 import_boot_images(http_proxy=proxy)663 import_boot_images(sources=[], http_proxy=proxy)
664 self.assertEqual(664 self.assertEqual(
665 {665 {
666 var: proxy666 var: proxy
@@ -670,13 +670,13 @@
670 def test_import_boot_images_leaves_proxy_unchanged_if_not_given(self):670 def test_import_boot_images_leaves_proxy_unchanged_if_not_given(self):
671 proxy_vars = ['http_proxy', 'https_proxy']671 proxy_vars = ['http_proxy', 'https_proxy']
672 fake = self.patch_boot_resources_function()672 fake = self.patch_boot_resources_function()
673 import_boot_images()673 import_boot_images(sources=[])
674 self.assertEqual({}, utils.filter_dict(fake.env, proxy_vars))674 self.assertEqual({}, utils.filter_dict(fake.env, proxy_vars))
675675
676 def test_import_boot_images_calls_callback(self):676 def test_import_boot_images_calls_callback(self):
677 self.patch_boot_resources_function()677 self.patch_boot_resources_function()
678 mock_callback = Mock()678 mock_callback = Mock()
679 import_boot_images(callback=mock_callback)679 import_boot_images(sources=[], callback=mock_callback)
680 self.assertThat(mock_callback.delay, MockCalledOnceWith())680 self.assertThat(mock_callback.delay, MockCalledOnceWith())
681681
682 def test_import_boot_images_accepts_sources_parameter(self):682 def test_import_boot_images_accepts_sources_parameter(self):