1 package club.wpia.gigi;
3 import static org.hamcrest.CoreMatchers.*;
4 import static org.junit.Assert.*;
6 import java.io.IOException;
7 import java.security.GeneralSecurityException;
11 import club.wpia.gigi.testUtils.ClientTest;
12 import club.wpia.gigi.testUtils.IOUtils;
14 public class TestCommunityCAOff extends ClientTest {
16 protected static boolean isCommunityCATest = false;
19 public void testMenuLoggedIn() throws GeneralSecurityException, IOException, GigiApiException, InterruptedException {
20 String content = IOUtils.readURL(get("/"));
23 // add RA Agent Status in later software version
26 testContent(content, "href=\"/wot/ttp\">Request TTP", !isCommunityCATest);
27 testContent(content, "href=\"/wot/rules\">Verification Rules", !isCommunityCATest);
30 testContent(content, "href=\"/account/find-agent\">Access to Find Agent", !isCommunityCATest);
32 assertThat(content, (containsString("Logged in")));
37 public void testMenuLoggedOut() throws GeneralSecurityException, IOException, GigiApiException, InterruptedException {
38 String content = IOUtils.readURL(get("/logout"));
39 content = IOUtils.readURL(get("/"));
42 // add RA Agent Status in later software version
44 assertThat(content, not((containsString("Logged in"))));
46 // text on not login page
47 testContent(content, "therefore 6 months only.", isCommunityCATest);
51 public void testMyDetails() throws GeneralSecurityException, IOException, GigiApiException, InterruptedException {
52 String content = IOUtils.readURL(get("/account/details"));
53 testContent(content, "RA Agent Contract", !isCommunityCATest);
56 private void testContent(String content, String reference, boolean visible) {
58 assertThat(content, containsString(reference));
60 assertThat(content, not(containsString(reference)));