diff options
author | Thomas <> | 2022-12-01 17:20:48 +0100 |
---|---|---|
committer | Thomas <> | 2022-12-01 17:20:48 +0100 |
commit | 566f85f5a93e83074f15a6f7caf5e16a04012d26 (patch) | |
tree | 886ab2723c3f65866e76ffb0a1affd906d8972ca | |
parent | 0c2d5044e7b75d102f630f9a2adf9e7e219e2731 (diff) | |
download | National_eIDAS_Gateway-566f85f5a93e83074f15a6f7caf5e16a04012d26.tar.gz National_eIDAS_Gateway-566f85f5a93e83074f15a6f7caf5e16a04012d26.tar.bz2 National_eIDAS_Gateway-566f85f5a93e83074f15a6f7caf5e16a04012d26.zip |
test(matching): check UX screen for 'disallowed new ERnP entry by user'
-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"); |