55
55
exhaustive_scan_request_dict ,
56
56
)
57
57
from ...responses import (
58
+ basic_batch_execute_statement_response ,
58
59
basic_batch_get_item_response ,
59
60
basic_batch_write_item_put_response ,
60
61
basic_delete_item_response ,
62
+ basic_execute_statement_response ,
63
+ basic_execute_transaction_response ,
61
64
basic_get_item_response ,
62
65
basic_put_item_response ,
63
66
basic_query_response ,
64
67
basic_scan_response ,
65
68
basic_transact_get_items_response ,
66
69
basic_transact_write_items_response ,
67
70
basic_update_item_response ,
71
+ exhaustive_batch_execute_statement_response ,
68
72
exhaustive_batch_get_item_response ,
69
73
exhaustive_batch_write_item_put_response ,
74
+ exhaustive_delete_item_response ,
75
+ exhaustive_execute_statement_response ,
70
76
exhaustive_get_item_response ,
71
77
exhaustive_put_item_response ,
72
78
exhaustive_query_response ,
73
79
exhaustive_scan_response ,
80
+ exhaustive_update_item_response ,
74
81
)
75
82
76
83
client_to_resource_converter = ClientShapeToResourceShapeConverter ()
@@ -560,15 +567,13 @@ def test_GIVEN_test_transact_get_items_response_WHEN_client_to_resource_THEN_ret
560
567
def test_update_item_request_ddb ():
561
568
# Select unsigned attribute without loss of generality;
562
569
# resource/client logic doesn't care about signed attributes
563
- # TODO: Add exhaustive request
564
570
return basic_update_item_request_ddb_unsigned_attribute
565
571
566
572
567
573
@pytest .fixture
568
574
def test_update_item_request_dict ():
569
575
# Select unsigned attribute without loss of generality;
570
576
# resource/client logic doesn't care about signed attributes
571
- # TODO: Add exhaustive request
572
577
return basic_update_item_request_dict_unsigned_attribute
573
578
574
579
@@ -584,8 +589,9 @@ def test_GIVEN_test_update_item_request_WHEN_client_to_resource_THEN_returns_dic
584
589
585
590
586
591
@pytest .fixture
587
- def test_update_item_response ():
588
- # TODO: Add exhaustive response
592
+ def test_update_item_response (use_exhaustive_request ):
593
+ if use_exhaustive_request :
594
+ return exhaustive_update_item_response
589
595
return basic_update_item_response
590
596
591
597
@@ -616,14 +622,22 @@ def test_GIVEN_test_execute_statement_request_WHEN_client_to_resource_THEN_retur
616
622
assert dict_item == test_execute_statement_request (test_dict_item )
617
623
618
624
619
- def test_GIVEN_test_execute_statement_response_WHEN_client_to_resource_THEN_raises_NotImplementedError ():
625
+ @pytest .fixture
626
+ def test_execute_statement_response (use_exhaustive_request ):
627
+ if use_exhaustive_request :
628
+ return exhaustive_execute_statement_response
629
+ return basic_execute_statement_response
630
+
631
+
632
+ def test_GIVEN_test_execute_statement_response_WHEN_client_to_resource_THEN_returns_dict_value (
633
+ test_execute_statement_response , test_ddb_item , test_dict_item
634
+ ):
620
635
# Given: Execute statement response
621
- # TODO: this
622
- ddb_response = {}
636
+ ddb_response = test_execute_statement_response ([test_ddb_item ])
623
637
# When: Converting to resource format
624
638
resource_response = client_to_resource_converter .execute_statement_response (ddb_response )
625
639
# Then: Returns dict value
626
- assert resource_response == {}
640
+ assert resource_response == test_execute_statement_response ([ test_dict_item ])
627
641
628
642
629
643
@pytest .fixture
@@ -642,18 +656,24 @@ def test_GIVEN_test_execute_transaction_request_WHEN_client_to_resource_THEN_ret
642
656
assert dict_item == test_execute_transaction_request (test_dict_item )
643
657
644
658
645
- def test_GIVEN_test_execute_transaction_response_WHEN_client_to_resource_THEN_returns_dict_value ():
659
+ @pytest .fixture
660
+ def test_execute_transaction_response ():
661
+ return basic_execute_transaction_response
662
+
663
+
664
+ def test_GIVEN_test_execute_transaction_response_WHEN_client_to_resource_THEN_returns_dict_value (
665
+ test_execute_transaction_response , test_ddb_item , test_dict_item
666
+ ):
646
667
# Given: Execute transaction response
647
- # TODO: this
648
- ddb_response = {}
668
+ ddb_response = test_execute_transaction_response ([test_ddb_item ])
649
669
# When: Converting to resource format
650
670
resource_response = client_to_resource_converter .execute_transaction_response (ddb_response )
651
671
# Then: Returns dict value
652
- assert resource_response == {}
672
+ assert resource_response == test_execute_transaction_response ([ test_dict_item ])
653
673
654
674
655
675
@pytest .fixture
656
- def test_batch_execute_statement_request ():
676
+ def test_batch_execute_statement_request (use_exhaustive_request ):
657
677
return basic_batch_execute_statement_request_encrypted_table
658
678
659
679
@@ -668,14 +688,22 @@ def test_GIVEN_test_batch_execute_statement_request_WHEN_client_to_resource_THEN
668
688
assert dict_item == test_batch_execute_statement_request ()
669
689
670
690
671
- def test_GIVEN_test_batch_execute_statement_response_WHEN_client_to_resource_THEN_raises_NotImplementedError ():
691
+ @pytest .fixture
692
+ def test_batch_execute_statement_response (use_exhaustive_request ):
693
+ if use_exhaustive_request :
694
+ return exhaustive_batch_execute_statement_response
695
+ return basic_batch_execute_statement_response
696
+
697
+
698
+ def test_GIVEN_test_batch_execute_statement_response_WHEN_client_to_resource_THEN_returns_dict_value (
699
+ test_batch_execute_statement_response , test_ddb_item , test_dict_item
700
+ ):
672
701
# Given: Batch execute statement response
673
- # TODO: this
674
- ddb_response = {}
702
+ ddb_response = test_batch_execute_statement_response ([test_ddb_item ])
675
703
# When: Converting to resource format
676
704
resource_response = client_to_resource_converter .batch_execute_statement_response (ddb_response )
677
705
# Then: Returns dict value
678
- assert resource_response == {}
706
+ assert resource_response == test_batch_execute_statement_response ([ test_dict_item ])
679
707
680
708
681
709
@pytest .fixture
@@ -700,7 +728,9 @@ def test_GIVEN_test_delete_item_request_WHEN_client_to_resource_THEN_returns_dic
700
728
701
729
702
730
@pytest .fixture
703
- def test_delete_item_response ():
731
+ def test_delete_item_response (use_exhaustive_request ):
732
+ if use_exhaustive_request :
733
+ return exhaustive_delete_item_response
704
734
return basic_delete_item_response
705
735
706
736
0 commit comments