Aaron Chancey
02/04/2021, 4:59 PMTRACE io.ktor.auth.jwt - Failed to get JWK: Failed to get key with kid null
Trying to figure out if this is a problem with creating a custom Token:
test("when register for game and userId is not found then NotFound is returned") {
coEvery { userRepositoryMock.getUser(any()) } returns null
withServer {
val req = handleRequest(HttpMethod.Get, "/api/game/1/2") {
addJwtHeader()
}
req.response.status() shouldBe HttpStatusCode.NotFound
req.response.content shouldBe "Could not find user."
}
}
private fun TestApplicationRequest.addJwtHeader() = addHeader("Authorization", "Bearer ${getToken()}")
private fun getToken() = FirebaseAuth.getInstance().createCustomToken(UUID.randomUUID().toString())
@ExperimentalCoroutinesApi
@KtorExperimentalAPI
@ExperimentalTime
private fun withServer(block: TestApplicationEngine.() -> Unit) {
withTestApplication({ module() }, block)
}
Appreciate any advice that can be offered.