@@ -21,14 +21,14 @@ struct ImperialTests {
21
21
func auth0Route( ) async throws {
22
22
try await withApp ( service: Auth0 . self) { app in
23
23
try await app. test (
24
- . GET, " /service " ,
24
+ . GET, apiAuthURL ,
25
25
afterResponse: { res async throws in
26
26
#expect( res. status == . seeOther)
27
27
}
28
28
)
29
29
30
30
try await app. test (
31
- . GET, " /service-auth-complete ?code=123" ,
31
+ . GET, " \( apiCallbackURL ) ?code=123 " ,
32
32
afterResponse: { res async throws in
33
33
// A real Auth0 domain is needed to test this route
34
34
#expect( res. status == . internalServerError)
@@ -41,14 +41,14 @@ struct ImperialTests {
41
41
func deviantArtRoute( ) async throws {
42
42
try await withApp ( service: DeviantArt . self) { app in
43
43
try await app. test (
44
- . GET, " /service " ,
44
+ . GET, apiAuthURL ,
45
45
afterResponse: { res async throws in
46
46
#expect( res. status == . seeOther)
47
47
}
48
48
)
49
49
50
50
try await app. test (
51
- . GET, " /service-auth-complete ?code=123" ,
51
+ . GET, " \( apiCallbackURL ) ?code=123 " ,
52
52
afterResponse: { res async throws in
53
53
// TODO: test this route
54
54
#expect( res. status != . notFound)
@@ -61,14 +61,14 @@ struct ImperialTests {
61
61
func discordRoute( ) async throws {
62
62
try await withApp ( service: Discord . self) { app in
63
63
try await app. test (
64
- . GET, " /service " ,
64
+ . GET, apiAuthURL ,
65
65
afterResponse: { res async throws in
66
66
#expect( res. status == . seeOther)
67
67
}
68
68
)
69
69
70
70
try await app. test (
71
- . GET, " /service-auth-complete ?code=123" ,
71
+ . GET, " \( apiCallbackURL ) ?code=123 " ,
72
72
afterResponse: { res async throws in
73
73
// Discord returns a 400 Bad Request error when the code is invalid with a JSON error message
74
74
#expect( res. status == . badRequest)
@@ -81,14 +81,14 @@ struct ImperialTests {
81
81
func dropboxRoute( ) async throws {
82
82
try await withApp ( service: Dropbox . self) { app in
83
83
try await app. test (
84
- . GET, " /service " ,
84
+ . GET, apiAuthURL ,
85
85
afterResponse: { res async throws in
86
86
#expect( res. status == . seeOther)
87
87
}
88
88
)
89
89
90
90
try await app. test (
91
- . GET, " /service-auth-complete ?code=123" ,
91
+ . GET, " \( apiCallbackURL ) ?code=123 " ,
92
92
afterResponse: { res async throws in
93
93
// Dropbox returns a 400 Bad Request error when the code is invalid with a JSON error message
94
94
#expect( res. status == . badRequest)
@@ -101,14 +101,14 @@ struct ImperialTests {
101
101
func facebookRoute( ) async throws {
102
102
try await withApp ( service: Facebook . self) { app in
103
103
try await app. test (
104
- . GET, " /service " ,
104
+ . GET, apiAuthURL ,
105
105
afterResponse: { res async throws in
106
106
#expect( res. status == . seeOther)
107
107
}
108
108
)
109
109
110
110
try await app. test (
111
- . GET, " /service-auth-complete ?code=123" ,
111
+ . GET, " \( apiCallbackURL ) ?code=123 " ,
112
112
afterResponse: { res async throws in
113
113
// The response is an JS, signaling an error with `redirect_uri`
114
114
#expect( res. status == . unsupportedMediaType)
@@ -121,14 +121,14 @@ struct ImperialTests {
121
121
func githubRoute( ) async throws {
122
122
try await withApp ( service: GitHub . self) { app in
123
123
try await app. test (
124
- . GET, " /service " ,
124
+ . GET, apiAuthURL ,
125
125
afterResponse: { res async throws in
126
126
#expect( res. status == . seeOther)
127
127
}
128
128
)
129
129
130
130
try await app. test (
131
- . GET, " /service-auth-complete ?code=123" ,
131
+ . GET, " \( apiCallbackURL ) ?code=123 " ,
132
132
afterResponse: { res async throws in
133
133
// The response is an HTML page likely signaling an error
134
134
#expect( res. status == . unsupportedMediaType)
@@ -141,14 +141,14 @@ struct ImperialTests {
141
141
func gitlabRoute( ) async throws {
142
142
try await withApp ( service: Gitlab . self) { app in
143
143
try await app. test (
144
- . GET, " /service " ,
144
+ . GET, apiAuthURL ,
145
145
afterResponse: { res async throws in
146
146
#expect( res. status == . seeOther)
147
147
}
148
148
)
149
149
150
150
try await app. test (
151
- . GET, " /service-auth-complete ?code=123" ,
151
+ . GET, " \( apiCallbackURL ) ?code=123 " ,
152
152
afterResponse: { res async throws in
153
153
// Gitlab returns a 400 Bad Request error when the code is invalid with a JSON error message
154
154
#expect( res. status == . badRequest)
@@ -161,14 +161,14 @@ struct ImperialTests {
161
161
func googleRoute( ) async throws {
162
162
try await withApp ( service: Google . self) { app in
163
163
try await app. test (
164
- . GET, " /service " ,
164
+ . GET, apiAuthURL ,
165
165
afterResponse: { res async throws in
166
166
#expect( res. status == . seeOther)
167
167
}
168
168
)
169
169
170
170
try await app. test (
171
- . GET, " /service-auth-complete ?code=123" ,
171
+ . GET, " \( apiCallbackURL ) ?code=123 " ,
172
172
afterResponse: { res async throws in
173
173
// Google returns a 400 Bad Request error when the code is invalid with a JSON error message
174
174
#expect( res. status == . badRequest)
@@ -181,14 +181,14 @@ struct ImperialTests {
181
181
func googleJWTRoute( ) async throws {
182
182
try await withApp ( service: GoogleJWT . self) { app in
183
183
try await app. test (
184
- . GET, " /service " ,
184
+ . GET, apiAuthURL ,
185
185
afterResponse: { res async throws in
186
186
#expect( res. status == . seeOther)
187
187
}
188
188
)
189
189
190
190
try await app. test (
191
- . GET, " /service-auth-complete " ,
191
+ . GET, apiCallbackURL ,
192
192
afterResponse: { res async throws in
193
193
// We don't have a valid key to sign the JWT
194
194
#expect( res. status == . internalServerError)
@@ -201,14 +201,14 @@ struct ImperialTests {
201
201
func imgurRoute( ) async throws {
202
202
try await withApp ( service: Imgur . self) { app in
203
203
try await app. test (
204
- . GET, " /service " ,
204
+ . GET, apiAuthURL ,
205
205
afterResponse: { res async throws in
206
206
#expect( res. status == . seeOther)
207
207
}
208
208
)
209
209
210
210
try await app. test (
211
- . GET, " /service-auth-complete ?code=123" ,
211
+ . GET, " \( apiCallbackURL ) ?code=123 " ,
212
212
afterResponse: { res async throws in
213
213
// TODO: test this route
214
214
#expect( res. status != . notFound)
@@ -221,14 +221,14 @@ struct ImperialTests {
221
221
func keycloakRoute( ) async throws {
222
222
try await withApp ( service: Keycloak . self) { app in
223
223
try await app. test (
224
- . GET, " /service " ,
224
+ . GET, apiAuthURL ,
225
225
afterResponse: { res async throws in
226
226
#expect( res. status == . seeOther)
227
227
}
228
228
)
229
229
230
230
try await app. test (
231
- . GET, " /service-auth-complete ?code=123" ,
231
+ . GET, " \( apiCallbackURL ) ?code=123 " ,
232
232
afterResponse: { res async throws in
233
233
// The post request fails
234
234
#expect( res. status == . internalServerError)
@@ -241,14 +241,14 @@ struct ImperialTests {
241
241
func microsoftRoute( ) async throws {
242
242
try await withApp ( service: Microsoft . self) { app in
243
243
try await app. test (
244
- . GET, " /service " ,
244
+ . GET, apiAuthURL ,
245
245
afterResponse: { res async throws in
246
246
#expect( res. status == . seeOther)
247
247
}
248
248
)
249
249
250
250
try await app. test (
251
- . GET, " /service-auth-complete ?code=123" ,
251
+ . GET, " \( apiCallbackURL ) ?code=123 " ,
252
252
afterResponse: { res async throws in
253
253
// Microsoft returns a 400 Bad Request, signaling an error with `redirect_uri`
254
254
#expect( res. status == . badRequest)
@@ -261,14 +261,14 @@ struct ImperialTests {
261
261
func mixcloudRoute( ) async throws {
262
262
try await withApp ( service: Mixcloud . self) { app in
263
263
try await app. test (
264
- . GET, " /service " ,
264
+ . GET, apiAuthURL ,
265
265
afterResponse: { res async throws in
266
266
#expect( res. status == . seeOther)
267
267
}
268
268
)
269
269
270
270
try await app. test (
271
- . GET, " /service-auth-complete ?code=123" ,
271
+ . GET, " \( apiCallbackURL ) ?code=123 " ,
272
272
afterResponse: { res async throws in
273
273
// TODO: test this route
274
274
#expect( res. status != . notFound)
0 commit comments