diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java index 037c76a1..a5d91107 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java @@ -292,6 +292,34 @@ public class GenerateOtherLoginMethodGuiTaskTest { } @Test + @SneakyThrows + public void jsonResponseInsertErnpScreenButNotAllowedHtml() throws TaskExecutionException, UnsupportedEncodingException { + executionContext.put(Constants.TRANSITION_TO_REQUESTING_NEW_ERNP_ENTRY_TASK, true); + LocaleContextHolder.setLocale(Locale.GERMAN); + httpReq.addHeader("Accept-Language", "de"); + + MatchingTaskUtils.storeIntermediateMatchingResult(pendingReq, + new RegisterStatusResults(new RegisterOperationStatus(null, false), + Collections.emptyList(), Collections.emptyList())); + + task.execute(pendingReq, executionContext); + + //result validation + Assert.assertEquals("Wrong http StatusCode", 200, httpResp.getStatus()); + Assert.assertEquals("Wrong http ContentType", "text/html;charset=UTF-8", httpResp.getContentType()); + + String html = httpResp.getContentAsString(); + Assert.assertNotNull("html result is null", html); + Assert.assertFalse("html result is empty", html.isEmpty()); + + Assert.assertTrue("No language selector with pendingRequestId", + html.contains("/otherLoginMethod?lang=en&pendingid=" + pendingReq.getPendingRequestId())); + Assert.assertFalse("find insert-ERnP-Button", + html.contains("value=\"ADD_ME_AS_NEW\"")); + + } + + @Test public void validHtmlResponseWithDE() throws TaskExecutionException, UnsupportedEncodingException { LocaleContextHolder.setLocale(Locale.GERMAN); httpReq.addHeader("Accept-Language", "de"); |