X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=tests%2Forg%2Fcacert%2Fgigi%2Fpages%2Faccount%2FTestDomain.java;h=49f1b85cb03940b8be38602ed198a3b5b0413d74;hb=ff8b2a0142c24f22a0fac2518eb0a6cd6b95ef12;hp=64cbab78d86a98ef0cd1dfdb940977a995a3b38f;hpb=e409ba881965634f63f0b67824bc93dda4ec4327;p=gigi.git diff --git a/tests/org/cacert/gigi/pages/account/TestDomain.java b/tests/org/cacert/gigi/pages/account/TestDomain.java index 64cbab78..49f1b85c 100644 --- a/tests/org/cacert/gigi/pages/account/TestDomain.java +++ b/tests/org/cacert/gigi/pages/account/TestDomain.java @@ -5,22 +5,44 @@ import static org.junit.Assert.*; import java.io.IOException; import java.net.URLEncoder; -import org.cacert.gigi.dbObjects.User; -import org.cacert.gigi.testUtils.ManagedTest; +import org.cacert.gigi.dbObjects.Domain; +import org.cacert.gigi.pages.account.domain.DomainOverview; +import org.cacert.gigi.testUtils.ClientTest; import org.junit.Test; -public class TestDomain extends ManagedTest { - - User u = User.getById(createVerifiedUser("testuser", "testname", uniq + "@testdom.com", TEST_PASSWORD)); - - String session = login(uniq + "@testdom.com", TEST_PASSWORD); +public class TestDomain extends ClientTest { public TestDomain() throws IOException {} @Test public void testAdd() throws IOException { - assertNull(addDomain(session, uniq + ".tld")); - assertNotNull(addDomain(session, uniq + ".tld")); + assertNull(addDomain(cookie, uniq + ".de")); + assertNotNull(addDomain(cookie, uniq + ".de")); + } + + @Test + public void testInvalid() throws IOException { + assertNotNull(addDomain(cookie, uniq + ".invalid")); + } + + @Test + public void testHighFinancialValue() throws IOException { + assertNotNull(addDomain(cookie, "google.com")); + } + + @Test + public void testDelete() throws IOException { + String domain = uniq + ".de"; + assertNull(addDomain(cookie, domain)); + Domain d0 = Domain.searchDomain(domain); + assertNull(executeBasicWebInteraction(cookie, DomainOverview.PATH, "delete=" + d0.getId(), 0)); + // double delete + assertNotNull(executeBasicWebInteraction(cookie, DomainOverview.PATH, "delete=" + d0.getId(), 0)); + // re-add + assertNull(addDomain(cookie, domain)); + Domain d1 = Domain.searchDomain(domain); + assertNotEquals(d0.getId(), d1.getId()); + assertNull(executeBasicWebInteraction(cookie, DomainOverview.PATH, "delete=" + d1.getId(), 0)); } public static String addDomain(String session, String domain) throws IOException {