Skip to content

Commit 340028c

Browse files
authored
fix: list_instances() uses filter_ arg (#143)
Co-authored-by: larkee <larkee@users.noreply.github.com>
1 parent a79786e commit 340028c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

google/cloud/spanner_v1/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ def list_instances(self, filter_="", page_size=None, page_token=None):
409409
metadata = _metadata_with_prefix(self.project_name)
410410
path = "projects/%s" % (self.project,)
411411
page_iter = self.instance_admin_api.list_instances(
412-
path, page_size=page_size, metadata=metadata
412+
path, filter_=filter_, page_size=page_size, metadata=metadata
413413
)
414414
page_iter.item_to_value = self._item_to_instance
415415
page_iter.next_page_token = page_token

tests/unit/test_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,16 +624,17 @@ def test_list_instances_w_options(self):
624624
)
625625

626626
token = "token"
627+
filter = "name:instance"
627628
page_size = 42
628-
list(client.list_instances(page_token=token, page_size=42))
629+
list(client.list_instances(filter_=filter, page_token=token, page_size=42))
629630

630631
expected_metadata = [
631632
("google-cloud-resource-prefix", client.project_name),
632633
("x-goog-request-params", "parent={}".format(client.project_name)),
633634
]
634635
li_api.assert_called_once_with(
635636
spanner_instance_admin_pb2.ListInstancesRequest(
636-
parent=self.PATH, page_size=page_size, page_token=token
637+
parent=self.PATH, filter=filter, page_size=page_size, page_token=token
637638
),
638639
metadata=expected_metadata,
639640
retry=mock.ANY,

0 commit comments

Comments
 (0)