X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=tests%2Forg%2Fcacert%2Fgigi%2FTestDomain.java;h=91f29c7a0389daaab33e9c25be80806c69218905;hb=d23d7a6fa9dc38c6193fea70017e0bff11257be5;hp=7ff9b53b92b8cfbe793131eb9101ecee2135716d;hpb=30d4d39245698b9257a6ce6810f55273a3ec25ef;p=gigi.git diff --git a/tests/org/cacert/gigi/TestDomain.java b/tests/org/cacert/gigi/TestDomain.java index 7ff9b53b..91f29c7a 100644 --- a/tests/org/cacert/gigi/TestDomain.java +++ b/tests/org/cacert/gigi/TestDomain.java @@ -19,29 +19,25 @@ public class TestDomain extends ManagedTest { @Test public void testDomain() throws InterruptedException, GigiApiException { assertEquals(0, us.getDomains().length); - Domain d = new Domain(us, "v1.example.org"); - assertEquals(0, d.getId()); - d.insert(); + Domain d = new Domain(us, us, "v1example.org"); Domain[] domains = us.getDomains(); assertEquals(1, domains.length); - assertEquals("v1.example.org", domains[0].getSuffix()); + assertEquals("v1example.org", domains[0].getSuffix()); assertEquals(domains[0].getOwner().getId(), us.getId()); assertNotEquals(0, domains[0].getId()); assertNotEquals(0, d.getId()); assertEquals(d.getId(), domains[0].getId()); - Domain d2 = new Domain(us, "v2.example.org"); - assertEquals(0, d2.getId()); - d2.insert(); + new Domain(us, us, "v2-example.org"); domains = us.getDomains(); assertEquals(2, domains.length); - if ( !domains[1].getSuffix().equals("v2.example.org")) { + if ( !domains[1].getSuffix().equals("v2-example.org")) { Domain d1 = domains[0]; domains[0] = domains[1]; domains[1] = d1; } - assertEquals("v2.example.org", domains[1].getSuffix()); + assertEquals("v2-example.org", domains[1].getSuffix()); assertEquals(domains[0].getOwner().getId(), us.getId()); assertEquals(domains[1].getOwner().getId(), us.getId()); assertNotEquals(0, domains[0].getId()); @@ -52,86 +48,32 @@ public class TestDomain extends ManagedTest { @Test public void testDoubleDomain() throws InterruptedException, GigiApiException { - Domain d = new Domain(us, "dub.example.org"); - d.insert(); + new Domain(us, us, "dub-example.org"); try { - Domain d2 = new Domain(us, "dub.example.org"); - d2.insert(); - fail("expected exception"); + new Domain(us, us, "dub-example.org"); + fail("expected exception, was able to insert domain (with different case) a second time"); } catch (GigiApiException e) { // expected } } @Test - public void testDoubleDomainDelete() throws InterruptedException, GigiApiException { - Domain d = new Domain(us, "del.example.org"); - d.insert(); - d.delete(); - Domain d2 = new Domain(us, "del.example.org"); - d2.insert(); - } - - @Test - public void testPrefixCheck() throws InterruptedException, GigiApiException { - String uni = createUniqueName() + "un.tld"; - Domain d0 = new Domain(us, uni); - d0.insert(); - d0.delete(); - Domain d = new Domain(us, "pref." + uni); - d.insert(); - - Domain d2 = new Domain(us, uni); + public void testDoubleDomainCase() throws InterruptedException, GigiApiException { + Domain d = new Domain(us, us, "dub2-ExaMple.Org"); + assertEquals("dub2-example.org", d.getSuffix()); try { - d2.insert(); - fail("Prefix match failed"); - } catch (GigiApiException e) { - } - d2 = new Domain(us, "a.pref." + uni); - try { - d2.insert(); - fail("Prefix match failed"); - } catch (GigiApiException e) { - } - d2 = new Domain(us, "pref." + uni); - try { - d2.insert(); - fail("exact match failed"); - } catch (GigiApiException e) { - } - - } - - @Test - public void testDoubleDomainPrefix() throws InterruptedException, GigiApiException { - Domain d = new Domain(us, "pref.aexample.org"); - d.insert(); - Domain d2 = new Domain(us, "a.pref.aexample.org"); - try { - d2.insert(); - fail("expected exception"); - } catch (GigiApiException e) { - // expected - } - Domain d3 = new Domain(us, "aexample.org"); - try { - d3.insert(); - fail("expected exception"); + new Domain(us, us, "duB2-eXample.oRG"); + fail("expected exception, was able to insert domain (with different case) a second time"); } catch (GigiApiException e) { // expected } } @Test - public void testDoubleInsertDomain() throws InterruptedException, GigiApiException { - Domain d = new Domain(us, "dins.example.org"); - d.insert(); - try { - d.insert(); - fail("expected exception"); - } catch (GigiApiException e) { - // expected - } + public void testDoubleDomainDelete() throws InterruptedException, GigiApiException { + Domain d = new Domain(us, us, "delexample.org"); + d.delete(); + new Domain(us, us, "delexample.org"); } }