aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLuke Sneeringer <luke@sneeringer.com>2019-02-23 15:39:50 -0800
committerChristopher Wilcox <crwilcox@google.com>2019-02-23 15:39:50 -0800
commitd9c3be106967426c1214bba3e28a0c1a7e970a67 (patch)
tree2d7b2018f6ccd638a7689b139eeb9ff0c16681ef /tests
parent355a4db4a597534a94deb1ff824b98eb901d0e68 (diff)
downloadpython-api-core-d9c3be106967426c1214bba3e28a0c1a7e970a67.tar.gz
Add `Operation.deserialize`. (#7427)
This commit adds a `deserialize` method to the Operation object. The class method is a helper to deserialize the serialized protobuf operation messages.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_operation.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/unit/test_operation.py b/tests/unit/test_operation.py
index ceaec82..a5346a7 100644
--- a/tests/unit/test_operation.py
+++ b/tests/unit/test_operation.py
@@ -231,3 +231,11 @@ def test_from_gapic():
assert future._metadata_type == struct_pb2.Struct
assert future.operation.name == TEST_OPERATION_NAME
assert future.done
+
+
+def test_deserialize():
+ op = make_operation_proto(name="foobarbaz")
+ serialized = op.SerializeToString()
+ deserialized_op = operation.Operation.deserialize(serialized)
+ assert op.name == deserialized_op.name
+ assert type(op) is type(deserialized_op)