def test_list_app_profiles(self): # Setup Expected Response next_page_token = "" app_profiles_element = {} app_profiles = [app_profiles_element] expected_response = { "next_page_token": next_page_token, "app_profiles": app_profiles, } expected_response = bigtable_instance_admin_pb2.ListAppProfilesResponse( **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]") paged_list_response = client.list_app_profiles(parent) resources = list(paged_list_response) assert len(resources) == 1 assert expected_response.app_profiles[0] == resources[0] assert len(channel.requests) == 1 expected_request = bigtable_instance_admin_pb2.ListAppProfilesRequest( parent=parent) actual_request = channel.requests[0][1] assert expected_request == actual_request
def test_list_app_profiles(self): # Setup Expected Response next_page_token = '' app_profiles_element = {} app_profiles = [app_profiles_element] expected_response = { 'next_page_token': next_page_token, 'app_profiles': app_profiles } expected_response = bigtable_instance_admin_pb2.ListAppProfilesResponse( **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]') paged_list_response = client.list_app_profiles(parent) resources = list(paged_list_response) assert len(resources) == 1 assert expected_response.app_profiles[0] == resources[0] assert len(channel.requests) == 1 expected_request = bigtable_instance_admin_pb2.ListAppProfilesRequest( parent=parent) actual_request = channel.requests[0][1] assert expected_request == actual_request