]> WPIA git - gigi.git/commitdiff
upd: cleanup support domain search test case
authorFelix Dörre <felix@dogcraft.de>
Sat, 2 Jul 2016 15:51:31 +0000 (17:51 +0200)
committerFelix Dörre <felix@dogcraft.de>
Sat, 2 Jul 2016 16:01:25 +0000 (18:01 +0200)
Change-Id: Iaa863ff43696675afbdcbdb5932371b93b8fe2c6

tests/org/cacert/gigi/pages/admin/TestSEAdminPageUserDomainSearch.java

index 4337e3324babc19f956991655398639cac941d9b..5c0f1e0b3c96037ec85e75a8ba508aaf3c9a2b44 100644 (file)
@@ -23,32 +23,37 @@ import org.junit.Test;
 
 public class TestSEAdminPageUserDomainSearch extends ClientTest {
 
-    public TestSEAdminPageUserDomainSearch() throws IOException {
+    private Domain d;
+
+    private String domainName;
+
+    private String unique;
+
+    private int tid;
+
+    public TestSEAdminPageUserDomainSearch() throws IOException, GigiApiException {
         grant(email, Group.SUPPORTER);
         assertEquals(302, post(cookie, SupportEnterTicketPage.PATH, "ticketno=a20140808.8&setTicket=action", 0).getResponseCode());
+
+        String mail = createUniqueName() + "@example.com";
+        tid = createVerifiedUser("Först", "Secönd", mail, TEST_PASSWORD);
+        User user = User.getById(tid);
+        unique = createUniqueName();
+        domainName = unique + "pattern.org";
+        this.d = new Domain(user, user, domainName);
     }
 
     @Test
     public void testDomainSearch() throws MalformedURLException, UnsupportedEncodingException, IOException, GigiApiException {
-        String mail = createUniqueName() + "@example.com";
-        int id = createVerifiedUser("Först", "Secönd", mail, TEST_PASSWORD);
-        User user = User.getById(id);
-        String domainName = createUniqueName() + ".org";
-        new Domain(user, user, domainName);
         URLConnection uc = post(FindDomainPage.PATH, "process&domain=" + URLEncoder.encode(domainName, "UTF-8"));
 
-        assertEquals("https://" + ServerConstants.getWwwHostNamePortSecure() + SupportUserDetailsPage.PATH + id, uc.getHeaderField("Location"));
+        assertEquals("https://" + ServerConstants.getWwwHostNamePortSecure() + SupportUserDetailsPage.PATH + tid, uc.getHeaderField("Location"));
     }
 
     @Test
     public void testDomainSearchById() throws MalformedURLException, UnsupportedEncodingException, IOException, GigiApiException {
-        String mail = createUniqueName() + "@example.com";
-        int id = createVerifiedUser("Först", "Secönd", mail, TEST_PASSWORD);
-        User user = User.getById(id);
-        String domainName = createUniqueName() + ".org";
-        Domain d = new Domain(user, user, domainName);
         URLConnection uc = post(FindDomainPage.PATH, "process&domain=#" + d.getId());
-        assertEquals("https://" + ServerConstants.getWwwHostNamePortSecure() + SupportUserDetailsPage.PATH + id, uc.getHeaderField("Location"));
+        assertEquals("https://" + ServerConstants.getWwwHostNamePortSecure() + SupportUserDetailsPage.PATH + tid, uc.getHeaderField("Location"));
     }
 
     @Test