def test_list_snapshots(self):
        # Setup Expected Response
        next_page_token = ''
        snapshots_element = {}
        snapshots = [snapshots_element]
        expected_response = {
            'next_page_token': next_page_token,
            'snapshots': snapshots
        }
        expected_response = bigtable_table_admin_pb2.ListSnapshotsResponse(
            **expected_response)

        # Mock the API response
        channel = ChannelStub(responses=[expected_response])
        client = bigtable_admin_v2.BigtableTableAdminClient(channel=channel)

        # Setup Request
        parent = client.cluster_path('[PROJECT]', '[INSTANCE]', '[CLUSTER]')

        paged_list_response = client.list_snapshots(parent)
        resources = list(paged_list_response)
        assert len(resources) == 1

        assert expected_response.snapshots[0] == resources[0]

        assert len(channel.requests) == 1
        expected_request = bigtable_table_admin_pb2.ListSnapshotsRequest(
            parent=parent)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request
    def test_list_snapshots(self):
        # Setup Expected Response
        next_page_token = ""
        snapshots_element = {}
        snapshots = [snapshots_element]
        expected_response = {
            "next_page_token": next_page_token,
            "snapshots": snapshots
        }
        expected_response = bigtable_table_admin_pb2.ListSnapshotsResponse(
            **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.BigtableTableAdminClient()

        # Setup Request
        parent = client.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")

        paged_list_response = client.list_snapshots(parent)
        resources = list(paged_list_response)
        assert len(resources) == 1

        assert expected_response.snapshots[0] == resources[0]

        assert len(channel.requests) == 1
        expected_request = bigtable_table_admin_pb2.ListSnapshotsRequest(
            parent=parent)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request