X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=tests%2Fclub%2Fwpia%2Fgigi%2Fpages%2FTestMain.java;fp=tests%2Fclub%2Fwpia%2Fgigi%2Fpages%2FTestMain.java;h=70a71a5dc50c6f7672ca699f24ea5aefd9095253;hp=47c4c151a7c4351fe96a58f85c482d49b93883e9;hb=7ea933e2e4cac62194d860cf213c1fd106ce76c5;hpb=86c54e084577b712268320f990facc8e9a09aec6 diff --git a/tests/club/wpia/gigi/pages/TestMain.java b/tests/club/wpia/gigi/pages/TestMain.java index 47c4c151..70a71a5d 100644 --- a/tests/club/wpia/gigi/pages/TestMain.java +++ b/tests/club/wpia/gigi/pages/TestMain.java @@ -142,5 +142,30 @@ public class TestMain extends ClientTest { authenticate((HttpURLConnection) uc); content = IOUtils.readURL(uc); assertThat(content, not(containsString("you need to pass the Support Challenge"))); + + // test Org Agent challenge + uc = new URL("https://" + getSecureServerName()).openConnection(); + authenticate((HttpURLConnection) uc); + content = IOUtils.readURL(uc); + assertThat(content, not(containsString("you need to pass the Organisation Agent Challenge"))); + + grant(u, Group.ORG_AGENT); + cookie = login(loginPrivateKey, loginCertificate.cert()); + uc = new URL("https://" + getSecureServerName()).openConnection(); + authenticate((HttpURLConnection) uc); + content = IOUtils.readURL(uc); + assertThat(content, containsString("you need to pass the Organisation Agent Challenge")); + + addChallengeInPast(u.getId(), CATSType.ORG_AGENT_CHALLENGE); + uc = new URL("https://" + getSecureServerName()).openConnection(); + authenticate((HttpURLConnection) uc); + content = IOUtils.readURL(uc); + assertThat(content, containsString("you need to pass the Organisation Agent Challenge")); + + addChallenge(u.getId(), CATSType.ORG_AGENT_CHALLENGE); + uc = new URL("https://" + getSecureServerName()).openConnection(); + authenticate((HttpURLConnection) uc); + content = IOUtils.readURL(uc); + assertThat(content, not(containsString("you need to pass the Organisation Agent Challenge"))); } }