Skip to content

Commit

Permalink
Fix saving in grpc (#916)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelboulton committed Feb 10, 2024
1 parent 12595a6 commit 3a8395a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
37 changes: 37 additions & 0 deletions example/grpc/test_grpc.tavern.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,43 @@ stages:

---

test_name: Test grpc saving

includes:
- !include common.yaml

grpc:
connect:
<<: *grpc_connect
proto:
module: helloworld_v1_precompiled_pb2_grpc

stages:
- name: Echo text
grpc_request:
service: helloworld.v1.Greeter/SayHello
body:
name: "John"
grpc_response:
status: "OK"
body:
message: "Hello, John!"
save:
body:
received_message: message

- name: Echo text
grpc_request:
service: helloworld.v1.Greeter/SayHello
body:
name: "{received_message}"
grpc_response:
status: "OK"
body:
message: "Hello, Hello, John!!"

---

test_name: Test trying to connect using an invalid option

includes:
Expand Down
2 changes: 1 addition & 1 deletion tavern/_plugins/grpc/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(
expected: Union[_GRPCExpected, Mapping],
test_block_config: TestConfig,
) -> None:
check_expected_keys({"body", "status", "details"}, expected)
check_expected_keys({"body", "status", "details", "save"}, expected)
super().__init__(name, expected, test_block_config)

self._client = client
Expand Down

0 comments on commit 3a8395a

Please sign in to comment.