Skip to content

Commit ee26c43

Browse files
jfussTarun K. Mall
authored andcommitted
chore(tests): Adding any tests (aws#2053)
* Adding api_request_model any tests * Add any to api_request_model_openapi_3 cases * Add rest of relevant any test cases * Fix hashing to match python2 * add api_with_swagger_authorizer_none to be run * fix py2 hashes in api_with_swagger_authorizer_none tests Co-authored-by: Jacob Fuss <[email protected]>
1 parent 240f820 commit ee26c43

File tree

117 files changed

+20383
-13068
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+20383
-13068
lines changed

tests/translator/input/api_request_model.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ Resources:
1515
RequestModel:
1616
Model: User
1717
Required: true
18+
AnyPath:
19+
Type: Api
20+
Properties:
21+
RestApiId: HtmlApi
22+
Path: /any
23+
Method: any
24+
RequestModel:
25+
Model: User
26+
Required: true
1827

1928
HtmlApi:
2029
Type: AWS::Serverless::Api

tests/translator/input/api_request_model_openapi_3.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ Resources:
2727
Path: /iam
2828
Auth:
2929
Authorizer: AWS_IAM
30+
AnyIam:
31+
Type: Api
32+
Properties:
33+
RequestModel:
34+
Model: User
35+
Required: true
36+
RestApiId:
37+
Ref: HtmlApi
38+
Method: any
39+
Path: /any/iam
40+
Auth:
41+
Authorizer: AWS_IAM
3042

3143

3244
HtmlApi:

tests/translator/input/api_with_apikey_required.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,11 @@ Resources:
1919
Method: get
2020
Auth:
2121
ApiKeyRequired: true
22+
MyApiWithApiKeyRequiredAnyMethod:
23+
Type: Api
24+
Properties:
25+
RestApiId: !Ref MyApiWithoutAuth
26+
Path: /any/ApiKeyRequiredTrue
27+
Method: any
28+
Auth:
29+
ApiKeyRequired: true

tests/translator/input/api_with_apikey_required_openapi_3.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,11 @@ Resources:
2020
Method: get
2121
Auth:
2222
ApiKeyRequired: true
23+
MyApiWithApiKeyRequiredAnyMethod:
24+
Type: Api
25+
Properties:
26+
RestApiId: !Ref MyApiWithoutAuth
27+
Path: /any/ApiKeyRequiredTrue
28+
Method: any
29+
Auth:
30+
ApiKeyRequired: true

tests/translator/input/api_with_auth_all_maximum.yaml

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Resources:
5050
Context:
5151
- Authorization4
5252
ReauthorizeEvery: 0
53-
53+
5454
MyFunction:
5555
Type: AWS::Serverless::Function
5656
Properties:
@@ -66,6 +66,14 @@ Resources:
6666
Method: get
6767
Auth:
6868
Authorizer: NONE
69+
WithNoAuthorizerAnyMethod:
70+
Type: Api
71+
Properties:
72+
RestApiId: !Ref MyApi
73+
Path: /any/noauth
74+
Method: any
75+
Auth:
76+
Authorizer: NONE
6977
WithCognitoMultipleUserPoolsAuthorizer:
7078
Type: Api
7179
Properties:
@@ -74,6 +82,14 @@ Resources:
7482
Method: post
7583
Auth:
7684
Authorizer: MyCognitoAuthMultipleUserPools
85+
WithCognitoMultipleUserPoolsAuthorizerAnyMethod:
86+
Type: Api
87+
Properties:
88+
RestApiId: !Ref MyApi
89+
Path: /any/cognitomultiple
90+
Method: any
91+
Auth:
92+
Authorizer: MyCognitoAuthMultipleUserPools
7793
WithLambdaTokenAuthorizer:
7894
Type: Api
7995
Properties:
@@ -82,14 +98,30 @@ Resources:
8298
Method: get
8399
Auth:
84100
Authorizer: MyLambdaTokenAuth
85-
WithLambdaTokenAuthorizer:
101+
WithLambdaTokenAuthorizerAnyMethod:
102+
Type: Api
103+
Properties:
104+
RestApiId: !Ref MyApi
105+
Path: /any/lambdatoken
106+
Method: any
107+
Auth:
108+
Authorizer: MyLambdaTokenAuth
109+
WithLambdaTokenNoneAuthorizer:
86110
Type: Api
87111
Properties:
88112
RestApiId: !Ref MyApi
89113
Path: /users
90114
Method: patch
91115
Auth:
92116
Authorizer: MyLambdaTokenAuthNoneFunctionInvokeRole
117+
WithLambdaTokenNoneAuthorizerAnyMethod:
118+
Type: Api
119+
Properties:
120+
RestApiId: !Ref MyApi
121+
Path: /any/lambdatokennone
122+
Method: any
123+
Auth:
124+
Authorizer: MyLambdaTokenAuthNoneFunctionInvokeRole
93125
WithLambdaRequestAuthorizer:
94126
Type: Api
95127
Properties:
@@ -98,9 +130,23 @@ Resources:
98130
Method: delete
99131
Auth:
100132
Authorizer: MyLambdaRequestAuth
133+
WithLambdaRequestAuthorizerAnyMethod:
134+
Type: Api
135+
Properties:
136+
RestApiId: !Ref MyApi
137+
Path: /any/lambdarequest
138+
Method: any
139+
Auth:
140+
Authorizer: MyLambdaRequestAuth
101141
WithDefaultAuthorizer:
102142
Type: Api
103143
Properties:
104144
RestApiId: !Ref MyApi
105145
Path: /users
106-
Method: put
146+
Method: put
147+
WithDefaultAuthorizerAnyMethod:
148+
Type: Api
149+
Properties:
150+
RestApiId: !Ref MyApi
151+
Path: /any/default
152+
Method: any

tests/translator/input/api_with_auth_all_maximum_openapi_3.yaml

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Resources:
5151
Context:
5252
- Authorization4
5353
ReauthorizeEvery: 0
54-
54+
5555
MyFunction:
5656
Type: AWS::Serverless::Function
5757
Properties:
@@ -67,6 +67,14 @@ Resources:
6767
Method: get
6868
Auth:
6969
Authorizer: NONE
70+
WithNoAuthorizerAnyMethod:
71+
Type: Api
72+
Properties:
73+
RestApiId: !Ref MyApi
74+
Path: /any/noauth
75+
Method: any
76+
Auth:
77+
Authorizer: NONE
7078
WithCognitoMultipleUserPoolsAuthorizer:
7179
Type: Api
7280
Properties:
@@ -75,6 +83,14 @@ Resources:
7583
Method: post
7684
Auth:
7785
Authorizer: MyCognitoAuthMultipleUserPools
86+
WithCognitoMultipleUserPoolsAuthorizerAnyMethod:
87+
Type: Api
88+
Properties:
89+
RestApiId: !Ref MyApi
90+
Path: /any/cognitomultiple
91+
Method: any
92+
Auth:
93+
Authorizer: MyCognitoAuthMultipleUserPools
7894
WithLambdaTokenAuthorizer:
7995
Type: Api
8096
Properties:
@@ -83,14 +99,30 @@ Resources:
8399
Method: get
84100
Auth:
85101
Authorizer: MyLambdaTokenAuth
86-
WithLambdaTokenAuthorizer:
102+
WithLambdaTokenAuthorizerAnyMethod:
103+
Type: Api
104+
Properties:
105+
RestApiId: !Ref MyApi
106+
Path: /any/lambdatoken
107+
Method: any
108+
Auth:
109+
Authorizer: MyLambdaTokenAuth
110+
WithLambdaTokenNoneAuthorizer:
87111
Type: Api
88112
Properties:
89113
RestApiId: !Ref MyApi
90114
Path: /users
91115
Method: patch
92116
Auth:
93117
Authorizer: MyLambdaTokenAuthNoneFunctionInvokeRole
118+
WithLambdaTokenNoneAuthorizerAnyMethod:
119+
Type: Api
120+
Properties:
121+
RestApiId: !Ref MyApi
122+
Path: /any/lambdatokennone
123+
Method: any
124+
Auth:
125+
Authorizer: MyLambdaTokenAuthNoneFunctionInvokeRole
94126
WithLambdaRequestAuthorizer:
95127
Type: Api
96128
Properties:
@@ -99,9 +131,23 @@ Resources:
99131
Method: delete
100132
Auth:
101133
Authorizer: MyLambdaRequestAuth
134+
WithLambdaRequestAuthorizerAnyMethod:
135+
Type: Api
136+
Properties:
137+
RestApiId: !Ref MyApi
138+
Path: /any/lambdarequest
139+
Method: any
140+
Auth:
141+
Authorizer: MyLambdaRequestAuth
102142
WithDefaultAuthorizer:
103143
Type: Api
104144
Properties:
105145
RestApiId: !Ref MyApi
106146
Path: /users
107-
Method: put
147+
Method: put
148+
WithDefaultAuthorizerAnyMethod:
149+
Type: Api
150+
Properties:
151+
RestApiId: !Ref MyApi
152+
Path: /any/default
153+
Method: any

tests/translator/input/api_with_auth_all_minimum.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,36 @@ Resources:
5151
RestApiId: !Ref MyApiWithCognitoAuth
5252
Method: get
5353
Path: /cognito
54+
CognitoAnyMethod:
55+
Type: Api
56+
Properties:
57+
RestApiId: !Ref MyApiWithCognitoAuth
58+
Method: any
59+
Path: /any/cognito
5460
LambdaToken:
5561
Type: Api
5662
Properties:
5763
RestApiId: !Ref MyApiWithLambdaTokenAuth
5864
Method: get
5965
Path: /lambda-token
66+
LambdaTokenAnyMethod:
67+
Type: Api
68+
Properties:
69+
RestApiId: !Ref MyApiWithLambdaTokenAuth
70+
Method: any
71+
Path: /any/lambda-token
6072
LambdaRequest:
6173
Type: Api
6274
Properties:
6375
RestApiId: !Ref MyApiWithLambdaRequestAuth
6476
Method: get
6577
Path: /lambda-request
78+
LambdaRequestAnyMethod:
79+
Type: Api
80+
Properties:
81+
RestApiId: !Ref MyApiWithLambdaRequestAuth
82+
Method: any
83+
Path: /any/lambda-request
6684
MyUserPool:
6785
Type: AWS::Cognito::UserPool
6886
Properties:

tests/translator/input/api_with_auth_all_minimum_openapi.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,36 @@ Resources:
5454
RestApiId: !Ref MyApiWithCognitoAuth
5555
Method: get
5656
Path: /cognito
57+
CognitoAnyMethod:
58+
Type: Api
59+
Properties:
60+
RestApiId: !Ref MyApiWithCognitoAuth
61+
Method: any
62+
Path: /any/cognito
5763
LambdaToken:
5864
Type: Api
5965
Properties:
6066
RestApiId: !Ref MyApiWithLambdaTokenAuth
6167
Method: get
6268
Path: /lambda-token
69+
LambdaTokenAnyMethod:
70+
Type: Api
71+
Properties:
72+
RestApiId: !Ref MyApiWithLambdaTokenAuth
73+
Method: any
74+
Path: /any/lambda-token
6375
LambdaRequest:
6476
Type: Api
6577
Properties:
6678
RestApiId: !Ref MyApiWithLambdaRequestAuth
6779
Method: get
6880
Path: /lambda-request
81+
LambdaRequestAnyMethod:
82+
Type: Api
83+
Properties:
84+
RestApiId: !Ref MyApiWithLambdaRequestAuth
85+
Method: any
86+
Path: /any/lambda-request
6987
MyUserPool:
7088
Type: AWS::Cognito::UserPool
7189
Properties:

tests/translator/input/api_with_auth_no_default.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,36 @@ Resources:
4848
RestApiId: !Ref MyApiWithCognitoAuth
4949
Method: get
5050
Path: /cognito
51+
CognitoAnyMethod:
52+
Type: Api
53+
Properties:
54+
RestApiId: !Ref MyApiWithCognitoAuth
55+
Method: any
56+
Path: /any/cognito
5157
LambdaToken:
5258
Type: Api
5359
Properties:
5460
RestApiId: !Ref MyApiWithLambdaTokenAuth
5561
Method: get
5662
Path: /lambda-token
63+
LambdaTokenAnyMethod:
64+
Type: Api
65+
Properties:
66+
RestApiId: !Ref MyApiWithLambdaTokenAuth
67+
Method: any
68+
Path: /any/lambda-token
5769
LambdaRequest:
5870
Type: Api
5971
Properties:
6072
RestApiId: !Ref MyApiWithLambdaRequestAuth
6173
Method: get
6274
Path: /lambda-request
75+
LambdaRequestAnyMethod:
76+
Type: Api
77+
Properties:
78+
RestApiId: !Ref MyApiWithLambdaRequestAuth
79+
Method: any
80+
Path: /any/lambda-request
6381
MyUserPool:
6482
Type: AWS::Cognito::UserPool
6583
Properties:

tests/translator/input/api_with_aws_account_blacklist.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,9 @@ Resources:
2323
Properties:
2424
Method: Put
2525
Path: /get
26+
Any:
27+
Type: Api
28+
Properties:
29+
Method: any
30+
Path: /any
31+

0 commit comments

Comments
 (0)