@@ -104,35 +104,36 @@ def test_s3_client(self):
104
104
)
105
105
106
106
# Comment test for issue 1088
107
- # @mock_s3
108
- # def test_s3_put(self):
109
- # params = dict(Key="foo", Bucket="mybucket", Body=b"bar")
110
- # s3 = self.session.create_client("s3", region_name="us-west-2")
111
- # s3.create_bucket(Bucket="mybucket")
112
- # s3.put_object(**params)
113
-
114
- # spans = self.memory_exporter.get_finished_spans()
115
- # assert spans
116
- # span = spans[0]
117
- # self.assertEqual(len(spans), 2)
118
- # self.assertEqual(span.attributes["aws.operation"], "CreateBucket")
119
- # assert_span_http_status_code(span, 200)
120
- # self.assertEqual(
121
- # span.resource,
122
- # Resource(
123
- # attributes={"endpoint": "s3", "operation": "createbucket"}
124
- # ),
125
- # )
126
- # self.assertEqual(spans[1].attributes["aws.operation"], "PutObject")
127
- # self.assertEqual(
128
- # spans[1].resource,
129
- # Resource(attributes={"endpoint": "s3", "operation": "putobject"}),
130
- # )
131
- # self.assertEqual(spans[1].attributes["params.Key"], str(params["Key"]))
132
- # self.assertEqual(
133
- # spans[1].attributes["params.Bucket"], str(params["Bucket"])
134
- # )
135
- # self.assertTrue("params.Body" not in spans[1].attributes.keys())
107
+ @mock_s3
108
+ def test_s3_put (self ):
109
+ params = dict (Key = "foo" , Bucket = "mybucket" , Body = b"bar" )
110
+ s3 = self .session .create_client ("s3" , region_name = "us-west-2" )
111
+ location = {"LocationConstraint" : "us-west-2" }
112
+ s3 .create_bucket (Bucket = "mybucket" , CreateBucketConfiguration = location )
113
+ s3 .put_object (** params )
114
+
115
+ spans = self .memory_exporter .get_finished_spans ()
116
+ assert spans
117
+ span = spans [0 ]
118
+ self .assertEqual (len (spans ), 2 )
119
+ self .assertEqual (span .attributes ["aws.operation" ], "CreateBucket" )
120
+ assert_span_http_status_code (span , 200 )
121
+ self .assertEqual (
122
+ span .resource ,
123
+ Resource (
124
+ attributes = {"endpoint" : "s3" , "operation" : "createbucket" }
125
+ ),
126
+ )
127
+ self .assertEqual (spans [1 ].attributes ["aws.operation" ], "PutObject" )
128
+ self .assertEqual (
129
+ spans [1 ].resource ,
130
+ Resource (attributes = {"endpoint" : "s3" , "operation" : "putobject" }),
131
+ )
132
+ self .assertEqual (spans [1 ].attributes ["params.Key" ], str (params ["Key" ]))
133
+ self .assertEqual (
134
+ spans [1 ].attributes ["params.Bucket" ], str (params ["Bucket" ])
135
+ )
136
+ self .assertTrue ("params.Body" not in spans [1 ].attributes .keys ())
136
137
137
138
@mock_sqs
138
139
def test_sqs_client (self ):
0 commit comments