예제 #1
0
    def testImageContainsBuilder(self):
        """MoblabVmTest calls service with correct args."""
        request = self._Input()
        response = self._Output()

        self.PatchObject(key_value_store,
                         'LoadFile',
                         return_value={
                             cros_set_lsb_release.LSB_KEY_BUILDER_PATH:
                             self.builder
                         })

        test_controller.MoblabVmTest(request, response, self.api_config)

        self.assertEqual(
            self.mock_create_moblab_vms.call_args_list,
            [mock.call(mock.ANY, self.chroot_dir, self.image_payload_dir)])
        self.assertEqual(
            self.mock_prepare_moblab_vm_image_cache.call_args_list,
            [mock.call(mock.ANY, self.builder, [self.autotest_payload_dir])])
        self.assertEqual(self.mock_run_moblab_vm_tests.call_args_list, [
            mock.call(mock.ANY, mock.ANY, self.builder, self.image_cache_dir,
                      mock.ANY)
        ])
        self.assertEqual(self.mock_validate_moblab_vm_tests.call_args_list,
                         [mock.call(mock.ANY)])
예제 #2
0
    def testImageMissingBuilder(self):
        """MoblabVmTest dies when builder path not found in lsb-release."""
        request = self._Input()
        response = self._Output()

        self.PatchObject(key_value_store, 'LoadFile', return_value={})

        with self.assertRaises(cros_build_lib.DieSystemExit):
            test_controller.MoblabVmTest(request, response, self.api_config)
예제 #3
0
    def testMockCall(self):
        """Test mock call does not execute any logic."""
        patch = self.PatchObject(key_value_store, 'LoadFile')

        # MoblabVmTest does not return a value, checking mocked value is flagged by
        # lint.
        test_controller.MoblabVmTest(self._Input(), self._Output(),
                                     self.mock_call_config)
        patch.assert_not_called()
예제 #4
0
 def testValidateOnly(self):
     """Sanity check that a validate only call does not execute any logic."""
     test_controller.MoblabVmTest(self._Input(), self._Output(),
                                  self.validate_only_config)
     self.mock_create_moblab_vms.assert_not_called()