]> WPIA git - gigi.git/commitdiff
add: Test Organisation Domain management
authorFelix Dörre <felix@dogcraft.de>
Thu, 23 Jun 2016 13:36:45 +0000 (15:36 +0200)
committerFelix Dörre <felix@dogcraft.de>
Mon, 27 Jun 2016 07:47:01 +0000 (09:47 +0200)
Change-Id: I8006e57f3e4e8755e1ae015b51e724fe79d8c2cc

tests/org/cacert/gigi/pages/orga/TestOrgDomain.java [new file with mode: 0644]

diff --git a/tests/org/cacert/gigi/pages/orga/TestOrgDomain.java b/tests/org/cacert/gigi/pages/orga/TestOrgDomain.java
new file mode 100644 (file)
index 0000000..0ee3b40
--- /dev/null
@@ -0,0 +1,43 @@
+package org.cacert.gigi.pages.orga;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.net.URLEncoder;
+
+import org.cacert.gigi.GigiApiException;
+import org.cacert.gigi.dbObjects.Domain;
+import org.cacert.gigi.dbObjects.Group;
+import org.cacert.gigi.dbObjects.Organisation;
+import org.cacert.gigi.testUtils.ClientTest;
+import org.junit.Test;
+
+public class TestOrgDomain extends ClientTest {
+
+    public TestOrgDomain() throws IOException {
+        makeAssurer(u.getId());
+        u.grantGroup(u, Group.ORGASSURER);
+        clearCaches();
+        cookie = login(email, TEST_PASSWORD);
+    }
+
+    @Test
+    public void testAdd() throws IOException, GigiApiException {
+        Organisation o1 = new Organisation(createUniqueName(), "st", "pr", "city", "test@example.com", u);
+        String dom = createUniqueName() + ".de";
+        assertNull(executeBasicWebInteraction(cookie, ViewOrgPage.DEFAULT_PATH + "/" + o1.getId(), "addDomain&domain=" + URLEncoder.encode(dom, "UTF-8"), 3));
+        Domain[] d = o1.getDomains();
+        assertEquals(1, d.length);
+        assertEquals(dom, d[0].getSuffix());
+    }
+
+    @Test
+    public void testDel() throws IOException, GigiApiException {
+        Organisation o1 = new Organisation(createUniqueName(), "st", "pr", "city", "test@example.com", u);
+        String dom = createUniqueName() + ".de";
+        Domain d = new Domain(u, o1, dom);
+        assertEquals(1, o1.getDomains().length);
+        assertNull(executeBasicWebInteraction(cookie, ViewOrgPage.DEFAULT_PATH + "/" + o1.getId(), "delete=" + d.getId(), 2));
+        assertEquals(0, o1.getDomains().length);
+    }
+}