def test_list_clusters(self): # Setup Expected Response next_page_token = "nextPageToken-1530815211" expected_response = {"next_page_token": next_page_token} expected_response = bigtable_instance_admin_pb2.ListClustersResponse( **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 = bigtable_admin_v2.BigtableInstanceAdminClient() # Setup Request parent = client.instance_path("[PROJECT]", "[INSTANCE]") response = client.list_clusters(parent) assert expected_response == response assert len(channel.requests) == 1 expected_request = bigtable_instance_admin_pb2.ListClustersRequest( parent=parent) actual_request = channel.requests[0][1] assert expected_request == actual_request
def test_list_clusters(self): # Setup Expected Response next_page_token = 'nextPageToken-1530815211' expected_response = {'next_page_token': next_page_token} expected_response = bigtable_instance_admin_pb2.ListClustersResponse( **expected_response) # Mock the API response channel = ChannelStub(responses=[expected_response]) client = bigtable_admin_v2.BigtableInstanceAdminClient(channel=channel) # Setup Request parent = client.instance_path('[PROJECT]', '[INSTANCE]') response = client.list_clusters(parent) assert expected_response == response assert len(channel.requests) == 1 expected_request = bigtable_instance_admin_pb2.ListClustersRequest( parent=parent) actual_request = channel.requests[0][1] assert expected_request == actual_request