@@ -31,37 +31,6 @@ pub async fn create_policy(
3131}
3232// snippet-end:[rust.example_code.iam.service.create_policy]
3333
34- #[ cfg( test) ]
35- mod test_create_policy {
36- use crate :: create_policy;
37- use http:: StatusCode ;
38- use sdk_examples_test_utils:: single_shot_client;
39-
40- #[ tokio:: test]
41- async fn test_create_policy_success ( ) {
42- let client = single_shot_client ! (
43- sdk: aws_sdk_iam,
44- status: StatusCode :: OK ,
45- response: include_str!( "../testing/test_create_policy_response_success.xml" )
46- ) ;
47-
48- let response = create_policy ( & client, "{}" , "test_role" ) . await ;
49- assert ! ( response. is_ok( ) ) ;
50- }
51-
52- #[ tokio:: test]
53- async fn test_create_policy_failed ( ) {
54- let client = single_shot_client ! (
55- sdk: aws_sdk_iam,
56- status: StatusCode :: BAD_REQUEST ,
57- response: include_str!( "../testing/test_create_policy_response_malformed.xml" )
58- ) ;
59-
60- let response = create_policy ( & client, "{}" , "test_role" ) . await ;
61- assert ! ( response. is_err( ) ) ;
62- }
63- }
64-
6534// snippet-start:[rust.example_code.iam.service.create_role]
6635pub async fn create_role (
6736 client : & iamClient ,
@@ -493,4 +462,38 @@ pub async fn list_saml_providers(
493462}
494463// snippet-end:[rust.example_code.iam.service.list_saml_providers]
495464
496- // snippet-end:[rust.example_code.iam.scenario_getting_started.lib]
465+
466+ // snippet-start:[rust.example_code.iam.service.create_policy.test]
467+ #[ cfg( test) ]
468+ mod test_create_policy {
469+ use crate :: create_policy;
470+ use http:: StatusCode ;
471+ use sdk_examples_test_utils:: single_shot_client;
472+
473+ #[ tokio:: test]
474+ async fn test_create_policy_success ( ) {
475+ let client = single_shot_client ! (
476+ sdk: aws_sdk_iam,
477+ status: StatusCode :: OK ,
478+ response: include_str!( "../testing/test_create_policy_response_success.xml" )
479+ ) ;
480+
481+ let response = create_policy ( & client, "{}" , "test_role" ) . await ;
482+ assert ! ( response. is_ok( ) ) ;
483+ }
484+
485+ #[ tokio:: test]
486+ async fn test_create_policy_failed ( ) {
487+ let client = single_shot_client ! (
488+ sdk: aws_sdk_iam,
489+ status: StatusCode :: BAD_REQUEST ,
490+ response: include_str!( "../testing/test_create_policy_response_malformed.xml" )
491+ ) ;
492+
493+ let response = create_policy ( & client, "{}" , "test_role" ) . await ;
494+ assert ! ( response. is_err( ) ) ;
495+ }
496+ }
497+ // snippet-end:[rust.example_code.iam.service.create_policy.test]
498+
499+ // snippet-end:[rust.example_code.iam.scenario_getting_started.lib]
0 commit comments