Beispiel #1
0
 def testValidateOnly(self):
     """Sanity check that a validate only call does not execute any logic."""
     patch = self.PatchObject(toolchain_util, 'OrderfileUpdateChromeEbuild')
     request = self._GetRequest(build_target=self.board,
                                artifact_type=toolchain_pb2.ORDERFILE)
     toolchain.UpdateEbuildWithAFDOArtifacts(request, self.response,
                                             self.validate_only_config)
     patch.assert_not_called()
Beispiel #2
0
 def testKernelAFDOSuccess(self):
     """Test the command is called correctly with kernel afdo."""
     request = self._GetRequest(build_target=self.board,
                                artifact_type=toolchain_pb2.KERNEL_AFDO)
     toolchain.UpdateEbuildWithAFDOArtifacts(request, self.response,
                                             self.api_config)
     self.kernel_command.assert_called_once_with(self.board)
     self.orderfile_command.assert_not_called()
     self.chrome_command.assert_not_called()
Beispiel #3
0
 def testMockCall(self):
     """Test that a mock call does not execute logic, returns mock value."""
     patch = self.PatchObject(toolchain_util, 'OrderfileUpdateChromeEbuild')
     request = self._GetRequest(build_target=self.board,
                                artifact_type=toolchain_pb2.ORDERFILE)
     toolchain.UpdateEbuildWithAFDOArtifacts(request, self.response,
                                             self.mock_call_config)
     patch.assert_not_called()
     self.assertEqual(self.response.status, True)
Beispiel #4
0
 def testWrongArtifactType(self):
     """Test passing wrong artifact type."""
     request = self._GetRequest(build_target=self.board,
                                artifact_type=self.invalid_artifact_type)
     with self.assertRaises(cros_build_lib.DieSystemExit) as context:
         toolchain.UpdateEbuildWithAFDOArtifacts(request, self.response,
                                                 self.api_config)
     self.assertIn(
         'artifact_type (%d) must be in' % self.invalid_artifact_type,
         str(context.exception))