def testGetChromeVersionHandleNone(self):
   """Verify basic return values."""
   self.PatchObject(packages_service, 'determine_chrome_version',
                    return_value=None)
   request = self._GetRequest(board='betty')
   packages_controller.GetChromeVersion(request, self.response,
                                        self.api_config)
   self.assertFalse(self.response.version)
 def testValidateOnly(self):
     """Sanity check that a validate only call does not execute any logic."""
     chrome_version = self.PatchObject(packages_service,
                                       'determine_chrome_version')
     request = self._GetRequest(board='betty')
     packages_controller.GetChromeVersion(request, self.response,
                                          self.validate_only_config)
     chrome_version.assert_not_called()
 def testMockCall(self):
     """Test that a mock call does not execute logic, returns mocked value."""
     chrome_version = self.PatchObject(packages_service,
                                       'determine_chrome_version')
     request = self._GetRequest(board='betty')
     packages_controller.GetChromeVersion(request, self.response,
                                          self.mock_call_config)
     chrome_version.assert_not_called()
     self.assertTrue(self.response.version)
 def testGetChromeVersion(self):
     """Verify basic return values."""
     chrome_version = '76.0.1.2'
     self.PatchObject(packages_service,
                      'determine_chrome_version',
                      return_value=chrome_version)
     request = self._GetRequest(board='betty')
     packages_controller.GetChromeVersion(request, self.response,
                                          self.api_config)
     self.assertEqual(self.response.version, chrome_version)
 def testGetChromeVersion(self):
   """Verify basic return values."""
   chrome_version = '76.0.1.2'
   chrome_version_mock = self.PatchObject(packages_service,
                                          'determine_chrome_version',
                                          return_value=chrome_version)
   request = self._GetRequest(board='betty')
   packages_controller.GetChromeVersion(request, self.response,
                                        self.api_config)
   self.assertEqual(self.response.version, chrome_version)
   # Verify call to determine_chrome_version passes a build_target object.
   build_target = build_target_lib.BuildTarget('betty')
   chrome_version_mock.assert_called_with(build_target)