From 566f85f5a93e83074f15a6f7caf5e16a04012d26 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 1 Dec 2022 17:20:48 +0100 Subject: test(matching): check UX screen for 'disallowed new ERnP entry by user' --- .../tasks/GenerateOtherLoginMethodGuiTaskTest.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'modules/authmodule-eIDAS-v2') 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 @@ -291,6 +291,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); -- cgit v1.2.3