-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathapis-test-cases.yaml
159 lines (139 loc) · 5.59 KB
/
apis-test-cases.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
config:
inherit-env: true
retries: 1
tests:
001 - list apis:
command: auth0 apis list
exit-code: 0
stdout:
contains:
- ID
- NAME
- IDENTIFIER
- SCOPES
002 - list apis with invalid number:
command: auth0 apis list --number 1001
exit-code: 1
stderr:
contains:
- Number flag invalid, please pass a number between 1 and 1000
003 - apis create and check data:
command: auth0 apis create --name integration-test-api-def1 --identifier http://integration-test-api-def1 --scopes read:todos,write:todos --signing-alg RS256 --json
exit-code: 0
stdout:
json:
name: integration-test-api-def1
identifier: http://integration-test-api-def1
scopes: "[map[value:read:todos] map[value:write:todos]]"
token_lifetime: "86400"
allow_offline_access: "false"
signing_alg: "RS256"
004 - apis create and check output:
command: auth0 apis create --name integration-test-api-def2 --identifier http://integration-test-api-def2 --scopes read:todos,write:todos --signing-alg RS256
exit-code: 0
stdout:
contains:
- NAME integration-test-api-def2
- IDENTIFIER http://integration-test-api-def2
- SCOPES read:todos write:todos
- TOKEN LIFETIME 86400
- ALLOW OFFLINE ACCESS ✗
- SIGNING ALGORITHM RS256
# Test 'apis create' --token-lifetime flag
005 - apis create token lifetime 1000 and check data:
command: auth0 apis create --name integration-test-api-toklif1 --identifier http://integration-test-api-toklif1 --scopes read:todos --token-lifetime 1000 --json
exit-code: 0
stdout:
json:
token_lifetime: "1000"
006 - apis create token lifetime 1000 and check output:
command: auth0 apis create --name integration-test-api-toklif2 --identifier http://integration-test-api-toklif2 --scopes read:todos --token-lifetime 1000
exit-code: 0
stdout:
contains:
- TOKEN LIFETIME 1000
# Test 'apis create' --offline-access flag
007 - apis create offline access true and check data:
command: auth0 apis create --name integration-test-api-offacc1 --identifier http://integration-test-api-offacc1 --scopes read:todos --offline-access --json
exit-code: 0
stdout:
json:
allow_offline_access: "true"
008 - apis create offline access true and check output:
command: auth0 apis create --name integration-test-api-offacc2 --identifier http://integration-test-api-offacc2 --scopes read:todos --offline-access
exit-code: 0
stdout:
contains:
- ALLOW OFFLINE ACCESS ✓
009 - apis create offline access false and check data:
command: auth0 apis create --name integration-test-api-offacc3 --identifier http://integration-test-api-offacc3 --scopes read:todos --offline-access=false --json
exit-code: 0
stdout:
json:
allow_offline_access: "false"
010 - apis show json:
command: auth0 apis show $(./test/integration/scripts/get-api-id.sh) --json # depends on "apis create test app" test
stdout:
json:
name: integration-test-api-newapi
identifier: http://integration-test-api-newapi
scopes: "[map[value:read:todos]]"
token_lifetime: "86400"
allow_offline_access: "false"
exit-code: 0
011 - apis show:
command: auth0 apis show $(./test/integration/scripts/get-api-id.sh) # depends on "apis create test app" test
stdout:
contains:
- NAME integration-test-api-newapi
- IDENTIFIER http://integration-test-api-newapi
- SCOPES read:todos
- TOKEN LIFETIME 86400
- ALLOW OFFLINE ACCESS ✗
exit-code: 0
012 - apis scopes list:
command: auth0 apis scopes list $(./test/integration/scripts/get-api-id.sh) # depends on "apis create test app" test
exit-code: 0
# Test 'apis update'; all tests depend on "apis create test api" test
013 - apis update name:
command: auth0 apis update $(./test/integration/scripts/get-api-id.sh) --name integration-test-api-betterApiName --json
stdout:
json:
name: integration-test-api-betterApiName
exit-code: 0
014 - apis update scopes:
command: auth0 apis update $(./test/integration/scripts/get-api-id.sh) --scopes read:todos,write:todos --json
stdout:
json:
scopes: "[map[value:read:todos] map[value:write:todos]]"
exit-code: 0
015 - apis update token lifetime:
command: auth0 apis update $(./test/integration/scripts/get-api-id.sh) --token-lifetime 1000 --json
stdout:
json:
token_lifetime: "1000"
exit-code: 0
016 - apis update offline access true:
command: auth0 apis update $(./test/integration/scripts/get-api-id.sh) --offline-access --json
stdout:
json:
allow_offline_access: "true"
exit-code: 0
017 - apis update offline access false:
command: auth0 apis update $(./test/integration/scripts/get-api-id.sh) --offline-access=false --json
stdout:
json:
allow_offline_access: "false"
exit-code: 0
018 - apis update signing algorithm:
command: auth0 apis update $(./test/integration/scripts/get-api-id.sh) --signing-alg=HS256 --json
stdout:
json:
signing_alg: "HS256"
exit-code: 0
018 - it successfully prints out a URL to open:
command: auth0 apis open $(./test/integration/scripts/get-api-id.sh) --no-input
exit-code: 0
stderr:
contains:
- "Open the following URL in a browser: https://manage.auth0.com/dashboard"