def testNoBuildTargetFails(self): """No build target argument should fail.""" request = self._GetRequest() with self.assertRaises(cros_build_lib.DieSystemExit): packages_controller.BuildsChrome(request, self.response, self.api_config)
def testValidateOnly(self): """Sanity check that a validate only call does not execute any logic.""" patch = self.PatchObject(packages_service, 'builds') request = self._GetRequest(board='betty') packages_controller.BuildsChrome(request, self.response, self.validate_only_config) patch.assert_not_called()
def testBuilds(self): """Test successful call handling.""" patch = self.PatchObject(packages_service, 'builds', return_value=True) request = self._GetRequest(board='foo') packages_controller.BuildsChrome(request, self.response, self.api_config) self.assertTrue(self.response.builds_chrome) patch.assert_called_once_with(constants.CHROME_CP, build_target_lib.BuildTarget('foo'), [])
def testBuildsChromeWithPackages(self): """Test successful call with packages handling.""" patch = self.PatchObject(packages_service, 'builds', return_value=True) package = common_pb2.PackageInfo( category='category', package_name='name', version='1.01', ) request = self._GetRequest(board='foo', packages=[package]) packages_controller.BuildsChrome(request, self.response, self.api_config) self.assertTrue(self.response.builds_chrome) patch.assert_called_once_with(constants.CHROME_CP, build_target_lib.BuildTarget('foo'), [controller_util.PackageInfoToCPV(package)])