From 94d7b4c4f052948dc0735c0ee683e4d4ce92f8dc Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Mon, 6 May 2024 11:42:11 +0200 Subject: test: add tests for token requests --- src/main/kotlin/dev/dnpm/etl/processor/web/ConfigController.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/main/kotlin/dev/dnpm') diff --git a/src/main/kotlin/dev/dnpm/etl/processor/web/ConfigController.kt b/src/main/kotlin/dev/dnpm/etl/processor/web/ConfigController.kt index 36589c8..4e101eb 100644 --- a/src/main/kotlin/dev/dnpm/etl/processor/web/ConfigController.kt +++ b/src/main/kotlin/dev/dnpm/etl/processor/web/ConfigController.kt @@ -127,10 +127,11 @@ class ConfigController( } else { model.addAttribute("tokensEnabled", true) val result = tokenService.addToken(name) - if (result.isSuccess) { - model.addAttribute("newTokenValue", result.getOrDefault("")) + result.onSuccess { + model.addAttribute("newTokenValue", it) model.addAttribute("success", true) - } else { + } + result.onFailure { model.addAttribute("success", false) } model.addAttribute("tokens", tokenService.findAll()) -- cgit v1.2.3