def test_get_entry_group(self): # Setup Expected Response name_2 = "name2-1052831874" display_name = "displayName1615086568" description = "description-1724546052" expected_response = { "name": name_2, "display_name": display_name, "description": description, } expected_response = datacatalog_pb2.EntryGroup(**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 = datacatalog_v1beta1.DataCatalogClient() # Setup Request name = client.entry_group_path("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]") response = client.get_entry_group(name) assert expected_response == response assert len(channel.requests) == 1 expected_request = datacatalog_pb2.GetEntryGroupRequest(name=name) actual_request = channel.requests[0][1] assert expected_request == actual_request
def test_update_entry_group(self): # Setup Expected Response name = "name3373707" display_name = "displayName1615086568" description = "description-1724546052" expected_response = { "name": name, "display_name": display_name, "description": description, } expected_response = datacatalog_pb2.EntryGroup(**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 = datacatalog_v1beta1.DataCatalogClient() # Setup Request entry_group = {} response = client.update_entry_group(entry_group) assert expected_response == response assert len(channel.requests) == 1 expected_request = datacatalog_pb2.UpdateEntryGroupRequest( entry_group=entry_group) actual_request = channel.requests[0][1] assert expected_request == actual_request
def test_create_entry_group(self): # Setup Expected Response name = "name3373707" display_name = "displayName1615086568" description = "description-1724546052" expected_response = { "name": name, "display_name": display_name, "description": description, } expected_response = datacatalog_pb2.EntryGroup(**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 = datacatalog_v1beta1.DataCatalogClient() # Setup Request parent = client.location_path("[PROJECT]", "[LOCATION]") entry_group_id = "entryGroupId-43122680" response = client.create_entry_group(parent, entry_group_id) assert expected_response == response assert len(channel.requests) == 1 expected_request = datacatalog_pb2.CreateEntryGroupRequest( parent=parent, entry_group_id=entry_group_id ) actual_request = channel.requests[0][1] assert expected_request == actual_request