17
17
import botocore .session
18
18
from botocore .exceptions import ParamValidationError
19
19
from moto import ( # pylint: disable=import-error
20
- mock_ec2 ,
21
20
mock_dynamodb2 ,
21
+ mock_ec2 ,
22
22
mock_kinesis ,
23
23
mock_kms ,
24
24
mock_lambda ,
@@ -203,22 +203,21 @@ def test_sqs_client(self):
203
203
def test_sqs_send_message (self ):
204
204
sqs = self .session .create_client ("sqs" , region_name = "us-east-1" )
205
205
206
- TEST_QUEUE_NAME = ' test_queue_name'
206
+ TEST_QUEUE_NAME = " test_queue_name"
207
207
208
- response = sqs .create_queue (
209
- QueueName = TEST_QUEUE_NAME
210
- )
208
+ response = sqs .create_queue (QueueName = TEST_QUEUE_NAME )
211
209
212
210
sqs .send_message (
213
- QueueUrl = response ["QueueUrl" ],
214
- MessageBody = "Test SQS MESSAGE!"
211
+ QueueUrl = response ["QueueUrl" ], MessageBody = "Test SQS MESSAGE!"
215
212
)
216
213
217
214
spans = self .memory_exporter .get_finished_spans ()
218
215
assert spans
219
216
self .assertEqual (len (spans ), 2 )
220
217
create_queue_attributes = dict (spans [0 ].attributes )
221
- self .assertRegex (create_queue_attributes ["aws.request_id" ], r"[A-Z0-9]{52}" )
218
+ self .assertRegex (
219
+ create_queue_attributes ["aws.request_id" ], r"[A-Z0-9]{52}"
220
+ )
222
221
del create_queue_attributes ["aws.request_id" ]
223
222
self .assertEqual (
224
223
create_queue_attributes ,
@@ -230,7 +229,9 @@ def test_sqs_send_message(self):
230
229
},
231
230
)
232
231
send_msg_attributes = dict (spans [1 ].attributes )
233
- self .assertRegex (send_msg_attributes ["aws.request_id" ], r"[A-Z0-9]{52}" )
232
+ self .assertRegex (
233
+ send_msg_attributes ["aws.request_id" ], r"[A-Z0-9]{52}"
234
+ )
234
235
del send_msg_attributes ["aws.request_id" ]
235
236
self .assertEqual (
236
237
send_msg_attributes ,
@@ -365,47 +366,27 @@ def test_dynamodb_client(self):
365
366
366
367
ddb .create_table (
367
368
AttributeDefinitions = [
368
- {
369
- 'AttributeName' : 'id' ,
370
- 'AttributeType' : 'S' ,
371
- },
372
- ],
373
- KeySchema = [
374
- {
375
- 'AttributeName' : 'id' ,
376
- 'KeyType' : 'HASH' ,
377
- },
369
+ {"AttributeName" : "id" , "AttributeType" : "S" },
378
370
],
371
+ KeySchema = [{"AttributeName" : "id" , "KeyType" : "HASH" }],
379
372
ProvisionedThroughput = {
380
- ' ReadCapacityUnits' : 5 ,
381
- ' WriteCapacityUnits' : 5 ,
373
+ " ReadCapacityUnits" : 5 ,
374
+ " WriteCapacityUnits" : 5 ,
382
375
},
383
376
TableName = TEST_TABLE_NAME ,
384
377
)
385
378
386
- ddb .put_item (
387
- TableName = TEST_TABLE_NAME ,
388
- Item = {
389
- 'id' : {
390
- 'S' : 'test_key'
391
- }
392
- }
393
- )
379
+ ddb .put_item (TableName = TEST_TABLE_NAME , Item = {"id" : {"S" : "test_key" }})
394
380
395
- ddb .get_item (
396
- TableName = TEST_TABLE_NAME ,
397
- Key = {
398
- 'id' : {
399
- 'S' : 'test_key'
400
- }
401
- }
402
- )
381
+ ddb .get_item (TableName = TEST_TABLE_NAME , Key = {"id" : {"S" : "test_key" }})
403
382
404
383
spans = self .memory_exporter .get_finished_spans ()
405
384
assert spans
406
385
self .assertEqual (len (spans ), 3 )
407
386
create_table_attributes = dict (spans [0 ].attributes )
408
- self .assertRegex (create_table_attributes ["aws.request_id" ], r"[A-Z0-9]{52}" )
387
+ self .assertRegex (
388
+ create_table_attributes ["aws.request_id" ], r"[A-Z0-9]{52}"
389
+ )
409
390
del create_table_attributes ["aws.request_id" ]
410
391
self .assertEqual (
411
392
create_table_attributes ,
@@ -418,7 +399,9 @@ def test_dynamodb_client(self):
418
399
},
419
400
)
420
401
put_item_attributes = dict (spans [1 ].attributes )
421
- self .assertRegex (put_item_attributes ["aws.request_id" ], r"[A-Z0-9]{52}" )
402
+ self .assertRegex (
403
+ put_item_attributes ["aws.request_id" ], r"[A-Z0-9]{52}"
404
+ )
422
405
del put_item_attributes ["aws.request_id" ]
423
406
self .assertEqual (
424
407
put_item_attributes ,
@@ -431,7 +414,9 @@ def test_dynamodb_client(self):
431
414
},
432
415
)
433
416
get_item_attributes = dict (spans [2 ].attributes )
434
- self .assertRegex (get_item_attributes ["aws.request_id" ], r"[A-Z0-9]{52}" )
417
+ self .assertRegex (
418
+ get_item_attributes ["aws.request_id" ], r"[A-Z0-9]{52}"
419
+ )
435
420
del get_item_attributes ["aws.request_id" ]
436
421
self .assertEqual (
437
422
get_item_attributes ,
0 commit comments