Package guru.zoroark.tegral.web.controllers.test

Types

Link copied to clipboard
interface ControllerTestContext : TestMutableInjectionEnvironment, ClientProvider

The context provided to applications in TegralControllerTest.test's block.

Link copied to clipboard
class DefaultControllerTestContext(    appBuilder: ApplicationTestBuilder,     environment: TestMutableInjectionEnvironment,     configureClient: KtorTestClientConfig.() -> Unit) : ControllerTestContext, TestMutableInjectionEnvironment, ClientProvider

A default implementation of ControllerTestContext that delegates implementations to existing elements.

Link copied to clipboard
typealias KtorTestClientConfig = HttpClientConfig<out HttpClientEngineConfig>
Link copied to clipboard
abstract class TegralControllerTest<TSubject : Any>(subjectClass: KClass<TSubject>, baseModule: InjectableModule) : TegralAbstractSubjectTest<TSubject, ControllerTestContext>

A subject-based test for Controllers-based classes (more specifically, for subclasses of KtorModule and KtorController).

Functions

Link copied to clipboard
fun KtorTestClientConfig.applyDefaultsModule()

Applies AppDefaults-compatible configuration for clients used in test classes.

Link copied to clipboard
fun assert2xx(response: HttpResponse)

Asserts that the response's status code is in the 2xx range (OK).

Link copied to clipboard
fun assert3xx(response: HttpResponse)

Asserts that the response's status code is in the 3xx range (Redirect).

Link copied to clipboard
fun assert4xx(response: HttpResponse)

Asserts that the response's status code is in the 4xx range (client error).

Link copied to clipboard
fun assert5xx(response: HttpResponse)

Asserts that the response's status code is in the 5xx range (server error).