]> WPIA git - gigi.git/blobdiff - tests/club/wpia/gigi/pages/orga/TestOrgManagement.java
add: ensure that for OrgAgent action there is a valid OrgAgent Challenge
[gigi.git] / tests / club / wpia / gigi / pages / orga / TestOrgManagement.java
index 6565d25fe04ed41a88933560823a661709d48d29..164facf6d179f9513726c3889341c760d8b45438 100644 (file)
@@ -17,6 +17,7 @@ import org.junit.After;
 import org.junit.Test;
 
 import club.wpia.gigi.GigiApiException;
 import org.junit.Test;
 
 import club.wpia.gigi.GigiApiException;
+import club.wpia.gigi.dbObjects.CATS.CATSType;
 import club.wpia.gigi.dbObjects.Certificate;
 import club.wpia.gigi.dbObjects.Country;
 import club.wpia.gigi.dbObjects.Country.CountryCodeType;
 import club.wpia.gigi.dbObjects.Certificate;
 import club.wpia.gigi.dbObjects.Country;
 import club.wpia.gigi.dbObjects.Country.CountryCodeType;
@@ -286,4 +287,16 @@ public class TestOrgManagement extends OrgTest {
         uc = get(cookie, CreateOrgPage.DEFAULT_PATH);
         assertEquals(403, ((HttpURLConnection) uc).getResponseCode());
     }
         uc = get(cookie, CreateOrgPage.DEFAULT_PATH);
         assertEquals(403, ((HttpURLConnection) uc).getResponseCode());
     }
+
+    @Test
+    public void testAgentWithoutValidChallenge() throws IOException, GigiApiException {
+        User agent = User.getById(createVerificationUser("testworker", "testname", createUniqueName() + "@testdom.com", TEST_PASSWORD));
+        addChallenge(agent.getId(), CATSType.ORG_AGENT_CHALLENGE);
+        loginCertificate = null;
+        cookie = cookieWithCertificateLogin(agent);
+        URLConnection uc = get(cookie, ViewOrgPage.DEFAULT_PATH);
+        assertEquals(403, ((HttpURLConnection) uc).getResponseCode());
+        uc = get(cookie, CreateOrgPage.DEFAULT_PATH);
+        assertEquals(403, ((HttpURLConnection) uc).getResponseCode());
+    }
 }
 }