]> WPIA git - gigi.git/blob - tests/club/wpia/gigi/TestCommunityCAOff.java
Merge "upd: remove 'browser install'"
[gigi.git] / tests / club / wpia / gigi / TestCommunityCAOff.java
1 package club.wpia.gigi;
2
3 import static org.hamcrest.CoreMatchers.*;
4 import static org.junit.Assert.*;
5
6 import java.io.IOException;
7 import java.security.GeneralSecurityException;
8
9 import org.junit.Test;
10
11 import club.wpia.gigi.testUtils.ClientTest;
12 import club.wpia.gigi.testUtils.IOUtils;
13
14 public class TestCommunityCAOff extends ClientTest {
15
16     protected static boolean isCommunityCATest = false;
17
18     @Test
19     public void testMenuLoggedIn() throws GeneralSecurityException, IOException, GigiApiException, InterruptedException {
20         String content = IOUtils.readURL(get("/"));
21
22         // Menu SomCA
23         // add RA Agent Status in later software version
24
25         // Menu Verification
26         testContent(content, "href=\"/wot/ttp\">Request TTP", !isCommunityCATest);
27         testContent(content, "href=\"/wot/rules\">Verification Rules", !isCommunityCATest);
28
29         // Menu My Details
30         testContent(content, "href=\"/account/find-agent\">Access to Find Agent", !isCommunityCATest);
31
32         assertThat(content, (containsString("Logged in")));
33
34     }
35
36     @Test
37     public void testMenuLoggedOut() throws GeneralSecurityException, IOException, GigiApiException, InterruptedException {
38         String content = IOUtils.readURL(get("/logout"));
39         content = IOUtils.readURL(get("/"));
40
41         // Menu SomCA
42         // add RA Agent Status in later software version
43
44         assertThat(content, not((containsString("Logged in"))));
45
46         // text on not login page
47         testContent(content, "therefore 6 months only.", isCommunityCATest);
48     }
49
50     @Test
51     public void testMyDetails() throws GeneralSecurityException, IOException, GigiApiException, InterruptedException {
52         String content = IOUtils.readURL(get("/account/details"));
53         testContent(content, "RA Agent Contract", !isCommunityCATest);
54     }
55
56     private void testContent(String content, String reference, boolean visible) {
57         if (visible) {
58             assertThat(content, containsString(reference));
59         } else {
60             assertThat(content, not(containsString(reference)));
61         }
62
63     }
64 }