Hi! I'm trying to write some tests for my ktor ser...
# ktor
h
Hi! I'm trying to write some tests for my ktor server routes. One challenge is to provide fakes/mocks for authentication. In the route I'm writing a test for I do:
Copy code
val principal = call.principal<JWTPrincipal>()
I don't need to verify the signature or anything like that of the JWT. All I need is to provide a fake JWT to the
install(Authentication) { jwt { ... } }
section in my test, but I can't figure out how to do this. Are there any examples or documentations for how to manually create the JWT in a test?
a
You might find the test in the jwt-auth-tests sample helpful, but it doesn't directly address your use case.
👍 1