96 lines
2.6 KiB
Kotlin
96 lines
2.6 KiB
Kotlin
package com.kmalbz
|
|
|
|
import io.ktor.config.*
|
|
import io.ktor.http.*
|
|
import io.ktor.server.testing.*
|
|
import kotlin.test.*
|
|
|
|
class SwaggerRoutesTest {
|
|
/**
|
|
* @see OutputServiceRDBServer.getallnegative
|
|
*/
|
|
@Test
|
|
fun testGetallnegative() {
|
|
withTestApplication {
|
|
// @TODO: Adjust path as required
|
|
handleRequest(HttpMethod.Get, "/output/filter/negative") {
|
|
}.apply {
|
|
// @TODO: Your test here
|
|
assertEquals(HttpStatusCode.OK, response.status())
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @see OutputServiceRDBServer.getallpositive
|
|
*/
|
|
@Test
|
|
fun testGetallpositive() {
|
|
withTestApplication {
|
|
// @TODO: Adjust path as required
|
|
handleRequest(HttpMethod.Get, "/output/filter/positive") {
|
|
}.apply {
|
|
// @TODO: Your test here
|
|
assertEquals(HttpStatusCode.OK, response.status())
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @see OutputServiceRDBServer.getallafter
|
|
*/
|
|
@Test
|
|
fun testGetallafter() {
|
|
withTestApplication {
|
|
// @TODO: Adjust path as required
|
|
handleRequest(HttpMethod.Get, "/output/after/{dateAfter}") {
|
|
}.apply {
|
|
// @TODO: Your test here
|
|
assertEquals(HttpStatusCode.OK, response.status())
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @see OutputServiceRDBServer.getallbefore
|
|
*/
|
|
@Test
|
|
fun testGetallbefore() {
|
|
withTestApplication {
|
|
// @TODO: Adjust path as required
|
|
handleRequest(HttpMethod.Get, "/output/before/{dateBefore}") {
|
|
}.apply {
|
|
// @TODO: Your test here
|
|
assertEquals(HttpStatusCode.OK, response.status())
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @see OutputServiceRDBServer.getDecision
|
|
*/
|
|
@Test
|
|
fun testGetDecision() {
|
|
withTestApplication {
|
|
// @TODO: Adjust path as required
|
|
handleRequest(HttpMethod.Get, "/output/{tagID}") {
|
|
}.apply {
|
|
// @TODO: Your test here
|
|
assertEquals(HttpStatusCode.OK, response.status())
|
|
}
|
|
}
|
|
}
|
|
|
|
fun <R> withTestApplication(test: TestApplicationEngine.() -> R): R {
|
|
return withApplication(createTestEnvironment()) {
|
|
(environment.config as MapApplicationConfig).apply {
|
|
put("jwt.secret", "TODO-change-this-supersecret-or-use-SECRET-env")
|
|
}
|
|
application.module()
|
|
test()
|
|
}
|
|
}
|
|
|
|
//fun TestApplicationRequest.setBodyJson(value: Any?) = setBody(Gson.stringify(value))
|
|
}
|