コード例 #1
0
 def test_calls_ListBootImagesV2_before_ListBootImages(self):
     rack_controller = factory.make_RackController()
     mock_client = MagicMock()
     self.patch_autospec(boot_images_module,
                         "getClientFor").return_value = mock_client
     get_boot_images(rack_controller)
     self.assertThat(mock_client, MockCalledOnceWith(ListBootImagesV2))
コード例 #2
0
ファイル: test_boot_images.py プロジェクト: shawnallen85/maas
 def test_calls_ListBootImages_if_raised_UnhandledCommand(self):
     rack_controller = factory.make_RackController()
     mock_client = MagicMock()
     self.patch_autospec(
         boot_images_module, "getClientFor"
     ).return_value = mock_client
     mock_client.return_value.wait.side_effect = [
         UnhandledCommand(),
         {"images": []},
     ]
     get_boot_images(rack_controller)
     self.assertThat(
         mock_client,
         MockCallsMatch(call(ListBootImagesV2), call(ListBootImages)),
     )
コード例 #3
0
    def test_returns_boot_images(self):
        rack_controller = factory.make_RackController()
        self.useFixture(RunningClusterRPCFixture())

        purposes = ['install', 'commissioning', 'xinstall']
        params = [make_boot_image_storage_params() for _ in range(3)]
        for param in params:
            make_image_dir(param, self.tftp_root)
            test_tftppath.make_osystem(self, param['osystem'], purposes)
        self.assertItemsEqual([
            make_image(param, purpose) for param in params
            for purpose in purposes
        ], get_boot_images(rack_controller))