ktor icon indicating copy to clipboard operation
ktor copied to clipboard

What's the correct pattern for testing authenticated routes?

Open lamba92 opened this issue 4 years ago • 3 comments

What would be a good pattern to test authenticated routes? Is it ok to generate real credentials? If not, how can you pass the authorization?

lamba92 avatar Aug 07 '20 09:08 lamba92

Any news?

jonathanoff2022 avatar Apr 24 '23 10:04 jonathanoff2022

Don't know if it is correct way, but what I do.

For tests I am using testcontainers and kotest. On startup of testapplication I am creating dummy user( which will use real endpoint to login - function which cqn be used on repeat Some common functions) and then i am making other requests with real token. Don't see any problem with it

victororlyk avatar May 06 '23 18:05 victororlyk

Don't know if it is correct way, but what I do.

For tests I am using testcontainers and kotest. On startup of testapplication I am creating dummy user( which will use real endpoint to login - function which cqn be used on repeat Some common functions) and then i am making other requests with real token. Don't see any problem with it

I've been doing the same, minus kotest, this hasn't had an answer in a long time, I guess we might never receive an official way.

FunkyMuse avatar Jul 18 '24 22:07 FunkyMuse