X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=tests%2Forg%2Fcacert%2Fgigi%2Fpages%2Forga%2FTestOrgManagement.java;h=c17b9abbf99311f83d4200372ff10176268fb348;hb=3b3fb85a74a666a9377549b04be32e8282c58a5b;hp=9700271276bca2eefe4730b8b53280fa088d83e5;hpb=46f79afcdf6712a830db12c6859ed91111a9b464;p=gigi.git diff --git a/tests/org/cacert/gigi/pages/orga/TestOrgManagement.java b/tests/org/cacert/gigi/pages/orga/TestOrgManagement.java index 97002712..c17b9abb 100644 --- a/tests/org/cacert/gigi/pages/orga/TestOrgManagement.java +++ b/tests/org/cacert/gigi/pages/orga/TestOrgManagement.java @@ -38,7 +38,7 @@ public class TestOrgManagement extends OrgTest { for (Organisation i : Organisation.getOrganisations(0, 30)) { i.delete(); } - executeBasicWebInteraction(cookie, CreateOrgPage.DEFAULT_PATH, "action=new&O=name&contact=mail@serv.tld&L=K%C3%B6ln&ST=" + URLEncoder.encode(DIFFICULT_CHARS, "UTF-8") + "&C=DE&comments=jkl%C3%B6loiuzfdfgjlh%C3%B6&optionalName=opname&postalAddress=postaladdress", 0); + assertNull(executeBasicWebInteraction(cookie, CreateOrgPage.DEFAULT_PATH, "action=new&O=name&contact=mail@serv.tld&L=K%C3%B6ln&ST=" + URLEncoder.encode(DIFFICULT_CHARS, "UTF-8") + "&C=DE&comments=jkl%C3%B6loiuzfdfgjlh%C3%B6&optionalName=opname&postalAddress=postaladdress", 0)); Organisation[] orgs = Organisation.getOrganisations(0, 30); assertEquals(1, orgs.length); assertEquals("mail@serv.tld", orgs[0].getContactEmail()); @@ -49,14 +49,14 @@ public class TestOrgManagement extends OrgTest { assertEquals("postaladdress", orgs[0].getPostalAddress()); User u2 = User.getById(createAssuranceUser("testworker", "testname", createUniqueName() + "@testdom.com", TEST_PASSWORD)); - executeBasicWebInteraction(cookie, ViewOrgPage.DEFAULT_PATH + "/" + orgs[0].getId(), "email=" + URLEncoder.encode(u2.getEmail(), "UTF-8") + "&do_affiliate=y&master=y", 1); + assertNull(executeBasicWebInteraction(cookie, ViewOrgPage.DEFAULT_PATH + "/" + orgs[0].getId(), "email=" + URLEncoder.encode(u2.getEmail(), "UTF-8") + "&do_affiliate=y&master=y", 1)); List allAdmins = orgs[0].getAllAdmins(); assertEquals(1, allAdmins.size()); Affiliation affiliation = allAdmins.get(0); assertSame(u2, affiliation.getTarget()); assertTrue(affiliation.isMaster()); - executeBasicWebInteraction(cookie, ViewOrgPage.DEFAULT_PATH + "/" + orgs[0].getId(), "email=" + URLEncoder.encode(u.getEmail(), "UTF-8") + "&do_affiliate=y", 1); + assertNull(executeBasicWebInteraction(cookie, ViewOrgPage.DEFAULT_PATH + "/" + orgs[0].getId(), "email=" + URLEncoder.encode(u.getEmail(), "UTF-8") + "&do_affiliate=y", 1)); allAdmins = orgs[0].getAllAdmins(); assertEquals(2, allAdmins.size()); Affiliation affiliation2 = allAdmins.get(0); @@ -66,13 +66,13 @@ public class TestOrgManagement extends OrgTest { assertEquals(u.getId(), affiliation2.getTarget().getId()); assertFalse(affiliation2.isMaster()); - executeBasicWebInteraction(cookie, ViewOrgPage.DEFAULT_PATH + "/" + orgs[0].getId(), "del=" + URLEncoder.encode(u.getEmail(), "UTF-8") + "&email=&do_affiliate=y", 1); + assertNull(executeBasicWebInteraction(cookie, ViewOrgPage.DEFAULT_PATH + "/" + orgs[0].getId(), "del=" + URLEncoder.encode(u.getEmail(), "UTF-8") + "&email=&do_affiliate=y", 1)); assertEquals(1, orgs[0].getAllAdmins().size()); - executeBasicWebInteraction(cookie, ViewOrgPage.DEFAULT_PATH + "/" + orgs[0].getId(), "del=" + URLEncoder.encode(u2.getEmail(), "UTF-8") + "&email=&do_affiliate=y", 1); + assertNull(executeBasicWebInteraction(cookie, ViewOrgPage.DEFAULT_PATH + "/" + orgs[0].getId(), "del=" + URLEncoder.encode(u2.getEmail(), "UTF-8") + "&email=&do_affiliate=y", 1)); assertEquals(0, orgs[0].getAllAdmins().size()); - executeBasicWebInteraction(cookie, ViewOrgPage.DEFAULT_PATH + "/" + orgs[0].getId(), "action=updateCertificateData&O=name1&contact=&L=K%C3%B6ln&ST=%C3%9C%C3%96%C3%84%C3%9F&C=DE&comments=jkl%C3%B6loiuzfdfgjlh%C3%B6", 0); + assertNull(executeBasicWebInteraction(cookie, ViewOrgPage.DEFAULT_PATH + "/" + orgs[0].getId(), "action=updateCertificateData&O=name1&contact=&L=K%C3%B6ln&ST=%C3%9C%C3%96%C3%84%C3%9F&C=DE&comments=jkl%C3%B6loiuzfdfgjlh%C3%B6", 0)); clearCaches(); orgs = Organisation.getOrganisations(0, 30); assertEquals("name1", orgs[0].getName()); @@ -118,7 +118,7 @@ public class TestOrgManagement extends OrgTest { Organisation o1 = createUniqueOrg(); o1.addAdmin(u3, u, true); try { - // must fail because u4 is no assurer + // must fail because u4 is no RA-Agent o1.addAdmin(u4_dummy, u3, false); fail("No exception!"); } catch (GigiApiException e) { @@ -131,7 +131,7 @@ public class TestOrgManagement extends OrgTest { } catch (GigiApiException e) { } try { - // must fail because u4 is no assurer + // must fail because u4 is no RA-Agent o1.addAdmin(u4_dummy, u, false); fail("No exception!"); } catch (GigiApiException e) { @@ -202,6 +202,10 @@ public class TestOrgManagement extends OrgTest { assertNotNull(upCertData(o1, o1.getName(), "D", o1.getProvince(), o1.getCity())); assertNull(upCertData(o1, o1.getName(), "DE", o1.getProvince(), o1.getCity())); assertNotNull(upCertData(o1, o1.getName(), "DES", o1.getProvince(), o1.getCity())); + // country code does not exist + assertNotNull(upCertData(o1, o1.getName(), "DD", o1.getProvince(), o1.getCity())); + // 3-letter country code should not be accepted + assertNotNull(upCertData(o1, o1.getName(), "DEU", o1.getProvince(), o1.getCity())); // test contact mail assertNull(upOptData(o1, o1.getContactEmail()));