diff options
author | Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> | 2021-01-25 12:49:39 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-25 12:49:39 -0700 |
commit | 97cef4ad1db55938715f9ac8000d1b0ad1e71873 (patch) | |
tree | 7592247119f1f1426fa5d4862106545f5f7ff5b9 /tests/unit/operations_v1 | |
parent | a47dfba3d43d403e6331992a386ec6d2202ee3da (diff) | |
download | python-api-core-97cef4ad1db55938715f9ac8000d1b0ad1e71873.tar.gz |
fix: add operation name to x-goog-request-params (#133)
Diffstat (limited to 'tests/unit/operations_v1')
-rw-r--r-- | tests/unit/operations_v1/test_operations_client.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/unit/operations_v1/test_operations_client.py b/tests/unit/operations_v1/test_operations_client.py index bd7f373..ed19b7f 100644 --- a/tests/unit/operations_v1/test_operations_client.py +++ b/tests/unit/operations_v1/test_operations_client.py @@ -24,9 +24,10 @@ def test_get_operation(): client = operations_v1.OperationsClient(channel) channel.GetOperation.response = operations_pb2.Operation(name="meep") - response = client.get_operation("name", metadata=[("x-goog-request-params", "foo")]) + response = client.get_operation("name", metadata=[("header", "foo")]) - assert ("x-goog-request-params", "foo") in channel.GetOperation.calls[0].metadata + assert ("header", "foo") in channel.GetOperation.calls[0].metadata + assert ("x-goog-request-params", "name=name") in channel.GetOperation.calls[0].metadata assert len(channel.GetOperation.requests) == 1 assert channel.GetOperation.requests[0].name == "name" assert response == channel.GetOperation.response @@ -42,12 +43,13 @@ def test_list_operations(): list_response = operations_pb2.ListOperationsResponse(operations=operations) channel.ListOperations.response = list_response - response = client.list_operations("name", "filter", metadata=[("x-goog-request-params", "foo")]) + response = client.list_operations("name", "filter", metadata=[("header", "foo")]) assert isinstance(response, page_iterator.Iterator) assert list(response) == operations - assert ("x-goog-request-params", "foo") in channel.ListOperations.calls[0].metadata + assert ("header", "foo") in channel.ListOperations.calls[0].metadata + assert ("x-goog-request-params", "name=name") in channel.ListOperations.calls[0].metadata assert len(channel.ListOperations.requests) == 1 request = channel.ListOperations.requests[0] assert isinstance(request, operations_pb2.ListOperationsRequest) @@ -60,9 +62,10 @@ def test_delete_operation(): client = operations_v1.OperationsClient(channel) channel.DeleteOperation.response = empty_pb2.Empty() - client.delete_operation("name", metadata=[("x-goog-request-params", "foo")]) + client.delete_operation("name", metadata=[("header", "foo")]) - assert ("x-goog-request-params", "foo") in channel.DeleteOperation.calls[0].metadata + assert ("header", "foo") in channel.DeleteOperation.calls[0].metadata + assert ("x-goog-request-params", "name=name") in channel.DeleteOperation.calls[0].metadata assert len(channel.DeleteOperation.requests) == 1 assert channel.DeleteOperation.requests[0].name == "name" @@ -72,8 +75,9 @@ def test_cancel_operation(): client = operations_v1.OperationsClient(channel) channel.CancelOperation.response = empty_pb2.Empty() - client.cancel_operation("name", metadata=[("x-goog-request-params", "foo")]) + client.cancel_operation("name", metadata=[("header", "foo")]) - assert ("x-goog-request-params", "foo") in channel.CancelOperation.calls[0].metadata + assert ("header", "foo") in channel.CancelOperation.calls[0].metadata + assert ("x-goog-request-params", "name=name") in channel.CancelOperation.calls[0].metadata assert len(channel.CancelOperation.requests) == 1 assert channel.CancelOperation.requests[0].name == "name" |