Пример #1
0
    def testValidateOnly(self):
        """Sanity check that a validate only call does not execute any logic."""
        patch = self.PatchObject(packages_service, 'get_best_visible')

        request = self._GetRequest(atom='chromeos-chrome')
        packages_controller.GetBestVisible(request, self.response,
                                           self.validate_only_config)
        patch.assert_not_called()
Пример #2
0
 def testMockCall(self):
     """Test that a mock call does not execute logic, returns mocked value."""
     patch = self.PatchObject(packages_service, 'get_best_visible')
     request = self._GetRequest(atom='chromeos-chrome')
     packages_controller.GetBestVisible(request, self.response,
                                        self.mock_call_config)
     patch.assert_not_called()
     self.assertTrue(self.response.package_info)
     self.assertTrue(self.response.package_info.category)
     self.assertTrue(self.response.package_info.package_name)
     self.assertTrue(self.response.package_info.version)
  def testSuccess(self):
    """Test overall success, argument handling, result forwarding."""
    cpv = self._MakeCpv('category', 'package', 'version')
    self.PatchObject(packages_service, 'get_best_visible', return_value=cpv)

    request = self._GetRequest(atom='chromeos-chrome')

    packages_controller.GetBestVisible(request, self.response, self.api_config)

    package_info_msg = self.response.package_info
    self.assertEqual(package_info_msg.category, cpv.category)
    self.assertEqual(package_info_msg.package_name, cpv.package)
    self.assertEqual(package_info_msg.version, cpv.version)
Пример #4
0
 def testNoAtomFails(self):
     """No atom provided should fail."""
     request = self._GetRequest()
     with self.assertRaises(cros_build_lib.DieSystemExit):
         packages_controller.GetBestVisible(request, self.response,
                                            self.api_config)