1515from google import showcase
1616
1717
18- # intercetped_metadata will be added by the interceptor automatically , and
18+ # `_METADATA` will be sent as part of the request , and the
1919# showcase server will echo it (since it has key 'showcase-trailer') as trailing
2020# metadata.
21- intercepted_metadata = (("showcase-trailer" , "intercepted" ),)
21+ _METADATA = (("showcase-trailer" , "intercepted" ),)
2222
2323
2424def test_unary_stream (intercepted_echo_grpc ):
@@ -28,7 +28,7 @@ def test_unary_stream(intercepted_echo_grpc):
2828 {
2929 "content" : content ,
3030 },
31- metadata = intercepted_metadata ,
31+ metadata = _METADATA ,
3232 )
3333
3434 for ground_truth , response in zip (content .split (" " ), responses ):
@@ -38,7 +38,7 @@ def test_unary_stream(intercepted_echo_grpc):
3838 response_metadata = [
3939 (metadata .key , metadata .value ) for metadata in responses .trailing_metadata ()
4040 ]
41- assert intercepted_metadata [0 ] in response_metadata
41+ assert _METADATA [0 ] in response_metadata
4242 interceptor .response_metadata = response_metadata
4343
4444
@@ -47,13 +47,13 @@ def test_stream_stream(intercepted_echo_grpc):
4747 requests = []
4848 requests .append (showcase .EchoRequest (content = "hello" ))
4949 requests .append (showcase .EchoRequest (content = "world!" ))
50- responses = client .chat (iter (requests ), metadata = intercepted_metadata )
50+ responses = client .chat (iter (requests ), metadata = _METADATA )
5151
5252 contents = [response .content for response in responses ]
5353 assert contents == ["hello" , "world!" ]
5454
5555 response_metadata = [
5656 (metadata .key , metadata .value ) for metadata in responses .trailing_metadata ()
5757 ]
58- assert intercepted_metadata [0 ] in response_metadata
58+ assert _METADATA [0 ] in response_metadata
5959 interceptor .response_metadata = response_metadata
0 commit comments