def testRegenBuildCache(self): """RegenBuildCache calls service with the correct args.""" regen_cache = self.PatchObject(binhost_service, 'RegenBuildCache') input_proto = binhost_pb2.RegenBuildCacheRequest() input_proto.overlay_type = binhost_pb2.OVERLAYTYPE_BOTH binhost.RegenBuildCache(input_proto, self.response, self.api_config) regen_cache.assert_called_once_with(mock.ANY, 'both')
def testValidateOnly(self): """Sanity check that a validate only call does not execute any logic.""" patch = self.PatchObject(binhost_service, 'RegenBuildCache') request = binhost_pb2.RegenBuildCacheRequest() request.overlay_type = binhost_pb2.OVERLAYTYPE_BOTH binhost.RegenBuildCache(request, self.response, self.validate_only_config) patch.assert_not_called()
def testRequiresOverlayType(self): """RegenBuildCache dies if overlay_type not specified.""" regen_cache = self.PatchObject(binhost_service, 'RegenBuildCache') input_proto = binhost_pb2.RegenBuildCacheRequest() input_proto.overlay_type = binhost_pb2.OVERLAYTYPE_UNSPECIFIED with self.assertRaises(cros_build_lib.DieSystemExit): binhost.RegenBuildCache(input_proto, self.response, self.api_config) regen_cache.assert_not_called()
def testMockCall(self): """Test that a mock call does not execute logic, returns mocked value.""" patch = self.PatchObject(binhost_service, 'RegenBuildCache') request = binhost_pb2.RegenBuildCacheRequest() request.overlay_type = binhost_pb2.OVERLAYTYPE_BOTH binhost.RegenBuildCache(request, self.response, self.mock_call_config) patch.assert_not_called() self.assertEqual(len(self.response.modified_overlays), 1) self.assertEqual(self.response.modified_overlays[0].path, '/path/to/BuildCache')