def test_undeploy_model(self): # Setup Expected Response expected_response = {} expected_response = empty_pb2.Empty(**expected_response) operation = operations_pb2.Operation( name="operations/test_undeploy_model", done=True ) operation.response.Pack(expected_response) # Mock the API response channel = ChannelStub(responses=[operation]) patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = automl_v1beta1.AutoMlClient() # Setup Request name = client.model_path("[PROJECT]", "[LOCATION]", "[MODEL]") response = client.undeploy_model(name) result = response.result() assert expected_response == result assert len(channel.requests) == 1 expected_request = service_pb2.UndeployModelRequest(name=name) actual_request = channel.requests[0][1] assert expected_request == actual_request
def test_undeploy_model(self): # Setup Expected Response name_2 = 'name2-1052831874' done = True expected_response = {'name': name_2, 'done': done} expected_response = operations_pb2.Operation(**expected_response) # Mock the API response channel = ChannelStub(responses=[expected_response]) client = automl_v1beta1.AutoMlClient(channel=channel) # Setup Request name = client.model_path('[PROJECT]', '[LOCATION]', '[MODEL]') response = client.undeploy_model(name) assert expected_response == response assert len(channel.requests) == 1 expected_request = service_pb2.UndeployModelRequest(name=name) actual_request = channel.requests[0][1] assert expected_request == actual_request
def test_undeploy_model(self): # Setup Expected Response name_2 = "name2-1052831874" done = True expected_response = {"name": name_2, "done": done} expected_response = operations_pb2.Operation(**expected_response) # Mock the API response channel = ChannelStub(responses=[expected_response]) patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = automl_v1beta1.AutoMlClient() # Setup Request name = client.model_path("[PROJECT]", "[LOCATION]", "[MODEL]") response = client.undeploy_model(name) assert expected_response == response assert len(channel.requests) == 1 expected_request = service_pb2.UndeployModelRequest(name=name) actual_request = channel.requests[0][1] assert expected_request == actual_request