@@ -683,8 +683,10 @@ def test_describe_policy_exception():
683
683
client .describe_policy (PolicyId = policy_id )
684
684
ex = e .value
685
685
assert ex .operation_name == "DescribePolicy"
686
- assert ex .response ["Error" ]["Code" ] == "400"
687
- assert "PolicyNotFoundException" in ex .response ["Error" ]["Message" ]
686
+ assert ex .response ["Error" ]["Code" ] == "PolicyNotFoundException"
687
+ assert (
688
+ ex .response ["Error" ]["Message" ] == "You specified a policy that doesn't exist."
689
+ )
688
690
with pytest .raises (ClientError ) as e :
689
691
client .describe_policy (PolicyId = "meaninglessstring" )
690
692
ex = e .value
@@ -896,8 +898,11 @@ def test_delete_policy_exception():
896
898
client .delete_policy (PolicyId = non_existent_policy_id )
897
899
ex = e .value
898
900
assert ex .operation_name == "DeletePolicy"
899
- assert ex .response ["Error" ]["Code" ] == "400"
900
- assert "PolicyNotFoundException" in ex .response ["Error" ]["Message" ]
901
+ assert ex .response ["Error" ]["Code" ] == "PolicyNotFoundException"
902
+ assert (
903
+ ex .response ["Error" ]["Message" ]
904
+ == "We can't find a policy with the PolicyId that you specified."
905
+ )
901
906
902
907
# Attempt to delete an attached policy
903
908
policy_id = client .create_policy (
@@ -993,8 +998,11 @@ def test_update_policy_exception():
993
998
client .update_policy (PolicyId = non_existent_policy_id )
994
999
ex = e .value
995
1000
assert ex .operation_name == "UpdatePolicy"
996
- assert ex .response ["Error" ]["Code" ] == "400"
997
- assert "PolicyNotFoundException" in ex .response ["Error" ]["Message" ]
1001
+ assert ex .response ["Error" ]["Code" ] == "PolicyNotFoundException"
1002
+ assert (
1003
+ ex .response ["Error" ]["Message" ]
1004
+ == "We can't find a policy with the PolicyId that you specified."
1005
+ )
998
1006
999
1007
1000
1008
@mock_organizations
@@ -1145,8 +1153,10 @@ def test_list_targets_for_policy_exception():
1145
1153
client .list_targets_for_policy (PolicyId = policy_id )
1146
1154
ex = e .value
1147
1155
assert ex .operation_name == "ListTargetsForPolicy"
1148
- assert ex .response ["Error" ]["Code" ] == "400"
1149
- assert "PolicyNotFoundException" in ex .response ["Error" ]["Message" ]
1156
+ assert ex .response ["Error" ]["Code" ] == "PolicyNotFoundException"
1157
+ assert (
1158
+ ex .response ["Error" ]["Message" ] == "You specified a policy that doesn't exist."
1159
+ )
1150
1160
with pytest .raises (ClientError ) as e :
1151
1161
client .list_targets_for_policy (PolicyId = "meaninglessstring" )
1152
1162
ex = e .value
0 commit comments