@@ -338,9 +338,7 @@ def diverse_item():
338
338
339
339
340
340
def return_requestitems_as_unprocessed (* args , ** kwargs ):
341
- return {
342
- "UnprocessedItems" : kwargs ['RequestItems' ]
343
- }
341
+ return {"UnprocessedItems" : kwargs ["RequestItems" ]}
344
342
345
343
346
344
def check_encrypted_item (plaintext_item , ciphertext_item , attribute_actions ):
@@ -495,10 +493,7 @@ def cycle_batch_writer_check(raw_table, encrypted_table, initial_actions, initia
495
493
496
494
497
495
def batch_write_item_unprocessed_check (
498
- encrypted ,
499
- initial_item ,
500
- write_transformer = _nop_transformer ,
501
- table_name = TEST_TABLE_NAME ,
496
+ encrypted , initial_item , write_transformer = _nop_transformer , table_name = TEST_TABLE_NAME
502
497
):
503
498
"""Check that unprocessed items in a batch result are unencrypted."""
504
499
items = _generate_items (initial_item , write_transformer )
@@ -565,11 +560,7 @@ def table_cycle_batch_writer_check(materials_provider, initial_actions, initial_
565
560
566
561
567
562
def table_batch_writer_unprocessed_items_check (
568
- materials_provider ,
569
- initial_actions ,
570
- initial_item ,
571
- table_name ,
572
- region_name = None
563
+ materials_provider , initial_actions , initial_item , table_name , region_name = None
573
564
):
574
565
kwargs = {}
575
566
if region_name is not None :
@@ -582,7 +573,7 @@ def table_batch_writer_unprocessed_items_check(
582
573
583
574
with patch .object (table .meta .client , "batch_write_item" ) as batch_write_mock :
584
575
# Check that unprocessed items returned to a BatchWriter are successfully retried
585
- batch_write_mock .side_effect = [{"UnprocessedItems" : request_items }, {' UnprocessedItems' : {}}]
576
+ batch_write_mock .side_effect = [{"UnprocessedItems" : request_items }, {" UnprocessedItems" : {}}]
586
577
e_table = EncryptedTable (table = table , materials_provider = materials_provider , attribute_actions = initial_actions )
587
578
588
579
with e_table .batch_writer () as writer :
@@ -616,27 +607,20 @@ def resource_cycle_batch_items_check(materials_provider, initial_actions, initia
616
607
617
608
618
609
def resource_batch_items_unprocessed_check (
619
- materials_provider ,
620
- initial_actions ,
621
- initial_item ,
622
- table_name ,
623
- region_name = None
610
+ materials_provider , initial_actions , initial_item , table_name , region_name = None
624
611
):
625
612
kwargs = {}
626
613
if region_name is not None :
627
614
kwargs ["region_name" ] = region_name
628
- resource = boto3 .resource (' dynamodb' , ** kwargs )
615
+ resource = boto3 .resource (" dynamodb" , ** kwargs )
629
616
630
617
with patch .object (resource , "batch_write_item" , return_requestitems_as_unprocessed ):
631
618
e_resource = EncryptedResource (
632
619
resource = resource , materials_provider = materials_provider , attribute_actions = initial_actions
633
620
)
634
621
635
622
batch_write_item_unprocessed_check (
636
- encrypted = e_resource ,
637
- initial_item = initial_item ,
638
- write_transformer = dict_to_ddb ,
639
- table_name = table_name ,
623
+ encrypted = e_resource , initial_item = initial_item , write_transformer = dict_to_ddb , table_name = table_name
640
624
)
641
625
642
626
@@ -691,27 +675,20 @@ def client_cycle_batch_items_check(materials_provider, initial_actions, initial_
691
675
692
676
693
677
def client_batch_items_unprocessed_check (
694
- materials_provider ,
695
- initial_actions ,
696
- initial_item ,
697
- table_name ,
698
- region_name = None
678
+ materials_provider , initial_actions , initial_item , table_name , region_name = None
699
679
):
700
680
kwargs = {}
701
681
if region_name is not None :
702
682
kwargs ["region_name" ] = region_name
703
- client = boto3 .client (' dynamodb' , ** kwargs )
683
+ client = boto3 .client (" dynamodb" , ** kwargs )
704
684
705
685
with patch .object (client , "batch_write_item" , return_requestitems_as_unprocessed ):
706
686
e_client = EncryptedClient (
707
687
client = client , materials_provider = materials_provider , attribute_actions = initial_actions
708
688
)
709
689
710
690
batch_write_item_unprocessed_check (
711
- encrypted = e_client ,
712
- initial_item = initial_item ,
713
- write_transformer = dict_to_ddb ,
714
- table_name = table_name ,
691
+ encrypted = e_client , initial_item = initial_item , write_transformer = dict_to_ddb , table_name = table_name
715
692
)
716
693
717
694
0 commit comments