X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;ds=inline;f=tests%2Fclub%2Fwpia%2Fgigi%2Fpages%2FTestMain.java;h=4c0ae78625a0028dfa5eae2025f90dbd42056d09;hb=601dc9522705bc8524dbe265174db69f8e0a1189;hp=dfc6579e07139d780b5c35fc167f488f7e1cccc0;hpb=1a5294e9825b7aa6868187cb4097b553f9d02543;p=gigi.git diff --git a/tests/club/wpia/gigi/pages/TestMain.java b/tests/club/wpia/gigi/pages/TestMain.java index dfc6579e..4c0ae786 100644 --- a/tests/club/wpia/gigi/pages/TestMain.java +++ b/tests/club/wpia/gigi/pages/TestMain.java @@ -81,7 +81,7 @@ public class TestMain extends ClientTest { authenticate((HttpURLConnection) uc); String content = IOUtils.readURL(uc); - assertThat(content, containsString("change to organisation administrator context")); + assertThat(content, containsString("Change to organisation administrator context")); assertThat(content, containsString("You are authenticated via certificate, so you will be able to perform all actions.")); } @@ -97,9 +97,10 @@ public class TestMain extends ClientTest { @Test public void testValidChallenges() throws GeneralSecurityException, IOException, GigiApiException, InterruptedException { - + insertRAContract(u.getId()); // test RA Agent challenge cookie = cookieWithCertificateLogin(u); + testChallengeText("you need to pass the RA Agent Challenge", false); add100Points(u.getId()); @@ -147,9 +148,26 @@ public class TestMain extends ClientTest { addChallenge(u.getId(), CATSType.TTP_AGENT_CHALLENGE); testChallengeText("you need to pass the TTP RA Agent Challenge", false); + + // test Org Admin Challenge + Organisation o = new Organisation(createUniqueName(), Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS), "pr", "city", "test@example.com", "", "", u); + User admin = User.getById(createVerificationUser("testworker", "testname", createUniqueName() + "@testdom.com", TEST_PASSWORD)); + + loginCertificate = null; + cookie = cookieWithCertificateLogin(admin); + testChallengeText("you need to pass the Organisation Administrator Challenge", false); + + o.addAdmin(admin, u, true); + testChallengeText("you need to pass the Organisation Administrator Challenge", true); + + addChallengeInPast(admin.getId(), CATSType.ORG_ADMIN_DP_CHALLENGE_NAME); + testChallengeText("you need to pass the Organisation Administrator Challenge", true); + + addChallenge(admin.getId(), CATSType.ORG_ADMIN_DP_CHALLENGE_NAME); + testChallengeText("you need to pass the Organisation Administrator Challenge", false); } - private void testChallengeText(String contentText, boolean contains) throws IOException, MalformedURLException { + private void testChallengeText(String contentText, boolean contains) throws IOException, MalformedURLException, GigiApiException { URLConnection uc = new URL("https://" + getSecureServerName()).openConnection(); authenticate((HttpURLConnection) uc); String content = IOUtils.readURL(uc);