]> WPIA git - gigi.git/commitdiff
add: more org-domain testcases
authorFelix Dörre <felix@dogcraft.de>
Fri, 24 Jun 2016 08:55:49 +0000 (10:55 +0200)
committerFelix Dörre <felix@dogcraft.de>
Mon, 27 Jun 2016 07:47:06 +0000 (09:47 +0200)
Change-Id: I871026d3221d009eb5ff850fa70e209185270090

tests/org/cacert/gigi/pages/orga/TestOrgDomain.java

index 0ee3b4094ece94ab7c2106271a9c096af0bc85c4..6d59f5ea5fc5b48d3ec0c04bc951bf529dedcc24 100644 (file)
@@ -40,4 +40,34 @@ public class TestOrgDomain extends ClientTest {
         assertNull(executeBasicWebInteraction(cookie, ViewOrgPage.DEFAULT_PATH + "/" + o1.getId(), "delete=" + d.getId(), 2));
         assertEquals(0, o1.getDomains().length);
     }
         assertNull(executeBasicWebInteraction(cookie, ViewOrgPage.DEFAULT_PATH + "/" + o1.getId(), "delete=" + d.getId(), 2));
         assertEquals(0, o1.getDomains().length);
     }
+
+    @Test
+    public void testBusinessAddWhileUser() throws IOException, GigiApiException {
+        Organisation o1 = new Organisation(createUniqueName(), "st", "pr", "city", "test@example.com", u);
+        String dom = createUniqueName() + ".de";
+        new Domain(u, u, dom);
+        try {
+            new Domain(u, o1, dom);
+            fail("Was able to add domain twice.");
+        } catch (GigiApiException e) {
+            assertEquals("Domain could not be inserted. Domain is already known to the system.", e.getMessage());
+            // expected
+        }
+        assertEquals(0, o1.getDomains().length);
+        assertEquals(1, u.getDomains().length);
+    }
+
+    @Test
+    public void testBusinessAddInvalid() throws IOException, GigiApiException {
+        Organisation o1 = new Organisation(createUniqueName(), "st", "pr", "city", "test@example.com", u);
+        String dom = createUniqueName() + ".invalid-tld";
+        try {
+            new Domain(u, o1, dom);
+            fail("Was able to add invalid domain.");
+        } catch (GigiApiException e) {
+            // expected
+        }
+        assertEquals(0, o1.getDomains().length);
+        assertEquals(0, u.getDomains().length);
+    }
 }
 }