@@ -900,12 +900,10 @@ async def test_user_agent_synthetic_bot_detection(self):
900900 # Clear headers first
901901 self .scope ["headers" ] = []
902902
903- def update_expected_synthetic_bot (expected ):
903+ def update_expected_synthetic_bot (expected , ua = user_agent ):
904904 expected [3 ]["attributes" ].update (
905905 {
906- SpanAttributes .HTTP_USER_AGENT : user_agent .decode (
907- "utf8"
908- ),
906+ SpanAttributes .HTTP_USER_AGENT : ua .decode ("utf8" ),
909907 USER_AGENT_SYNTHETIC_TYPE : "bot" ,
910908 }
911909 )
@@ -933,12 +931,10 @@ async def test_user_agent_synthetic_test_detection(self):
933931 # Clear headers first
934932 self .scope ["headers" ] = []
935933
936- def update_expected_synthetic_test (expected ):
934+ def update_expected_synthetic_test (expected , ua = user_agent ):
937935 expected [3 ]["attributes" ].update (
938936 {
939- SpanAttributes .HTTP_USER_AGENT : user_agent .decode (
940- "utf8"
941- ),
937+ SpanAttributes .HTTP_USER_AGENT : ua .decode ("utf8" ),
942938 USER_AGENT_SYNTHETIC_TYPE : "test" ,
943939 }
944940 )
@@ -967,13 +963,11 @@ async def test_user_agent_non_synthetic(self):
967963 # Clear headers first
968964 self .scope ["headers" ] = []
969965
970- def update_expected_non_synthetic (expected ):
966+ def update_expected_non_synthetic (expected , ua = user_agent ):
971967 # Should only have the user agent, not synthetic type
972968 expected [3 ]["attributes" ].update (
973969 {
974- SpanAttributes .HTTP_USER_AGENT : user_agent .decode (
975- "utf8"
976- ),
970+ SpanAttributes .HTTP_USER_AGENT : ua .decode ("utf8" ),
977971 }
978972 )
979973 return expected
0 commit comments