Skip to content

Commit a2950c3

Browse files
committed
Backfill test to ensure provider must be manually created
1 parent 8e85ad8 commit a2950c3

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Tests/VaporOAuthTests/IntegrationTests/AuthCodeResourceServerTests.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class AuthCodeResourceServerTests: XCTestCase {
2020
("testAccessingProtectedRouteWithLowercaseHeaderWorks", testAccessingProtectedRouteWithLowercaseHeaderWorks),
2121
("testThatAccessingProtectedRouteWithExpiredTokenReturns401", testThatAccessingProtectedRouteWithExpiredTokenReturns401),
2222
("testTokenIntrospectionEndpoint", testTokenIntrospectionEndpoint),
23+
("testErrorThrownIfTryingToInitialiseFromConfig", testErrorThrownIfTryingToInitialiseFromConfig),
2324
]
2425

2526
// MARK: - Properties
@@ -348,6 +349,21 @@ class AuthCodeResourceServerTests: XCTestCase {
348349

349350
XCTAssertEqual(noScopeResponse.status, .unauthorized)
350351
}
352+
353+
func testErrorThrownIfTryingToInitialiseFromConfig() throws {
354+
var errorThrown = false
355+
var errorDescription: String?
356+
let config = Config([:])
357+
do {
358+
try config.addProvider(VaporOAuth.Provider.self)
359+
} catch let error as OAuthProviderError {
360+
errorThrown = true
361+
errorDescription = error.description
362+
}
363+
364+
XCTAssertTrue(errorThrown)
365+
XCTAssertEqual("The OAuth Provider cannot be created with a Config and must be created manually", errorDescription)
366+
}
351367

352368
}
353369

0 commit comments

Comments
 (0)