Skip to content

Commit

Permalink
fix: list_instances() uses filter_ arg (#143)
Browse files Browse the repository at this point in the history
Co-authored-by: larkee <larkee@users.noreply.github.com>
  • Loading branch information
larkee and larkee committed Sep 8, 2020
1 parent a79786e commit 340028c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion google/cloud/spanner_v1/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions tests/unit/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 340028c

Please sign in to comment.