X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=tests%2Forg%2Fcacert%2Fgigi%2Fpages%2Faccount%2FTestDomain.java;h=49f1b85cb03940b8be38602ed198a3b5b0413d74;hb=d7c0f42f9a60ae6dfff83d1f01e547bbf5681c0d;hp=0b82a56ba78f9c85223a7c8f26f453b1c585e383;hpb=b1092da65fd373d945343e01dd8975ec3b84db0a;p=gigi.git diff --git a/tests/org/cacert/gigi/pages/account/TestDomain.java b/tests/org/cacert/gigi/pages/account/TestDomain.java index 0b82a56b..49f1b85c 100644 --- a/tests/org/cacert/gigi/pages/account/TestDomain.java +++ b/tests/org/cacert/gigi/pages/account/TestDomain.java @@ -5,23 +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.dbObjects.Domain; import org.cacert.gigi.pages.account.domain.DomainOverview; -import org.cacert.gigi.testUtils.ManagedTest; +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 {