Skip to content
Permalink
Browse files
fix: list_instances() uses filter_ arg (#143)
Co-authored-by: larkee <larkee@users.noreply.github.com>
  • Loading branch information
larkee and larkee committed Sep 8, 2020
1 parent a79786e commit 340028c8eafcb715e6e440c6d98048ecea802807
Showing with 4 additions and 3 deletions.
  1. +1 −1 google/cloud/spanner_v1/client.py
  2. +3 −2 tests/unit/test_client.py
@@ -409,7 +409,7 @@ def list_instances(self, filter_="", page_size=None, page_token=None):
metadata = _metadata_with_prefix(self.project_name)
path = "projects/%s" % (self.project,)
page_iter = self.instance_admin_api.list_instances(
path, page_size=page_size, metadata=metadata
path, filter_=filter_, page_size=page_size, metadata=metadata
)
page_iter.item_to_value = self._item_to_instance
page_iter.next_page_token = page_token
@@ -624,16 +624,17 @@ def test_list_instances_w_options(self):
)

token = "token"
filter = "name:instance"
page_size = 42
list(client.list_instances(page_token=token, page_size=42))
list(client.list_instances(filter_=filter, page_token=token, page_size=42))

expected_metadata = [
("google-cloud-resource-prefix", client.project_name),
("x-goog-request-params", "parent={}".format(client.project_name)),
]
li_api.assert_called_once_with(
spanner_instance_admin_pb2.ListInstancesRequest(
parent=self.PATH, page_size=page_size, page_token=token
parent=self.PATH, filter=filter, page_size=page_size, page_token=token
),
metadata=expected_metadata,
retry=mock.ANY,

0 comments on commit 340028c

Please sign in to comment.