Commit 96ce43b7 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

use built in admin account

parent f5f8b54c
......@@ -34,8 +34,6 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
private static final String TEST_PROJECT = "test_project";
private static final String CURATOR_PASSWORD = "test_pass";
private static final String CURATOR_LOGIN = "test_user";
private static final String ADMIN_PASSWORD = "admin_pass";
private static final String ADMIN_LOGIN = "admin_user";
Logger logger = LogManager.getLogger();
@Autowired
private IUserService userService;
......@@ -44,18 +42,15 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
private ProjectDao projectDao;
private User curator;
private User admin;
@Before
public void setup() {
curator = createCurator(CURATOR_LOGIN, CURATOR_PASSWORD);
admin = createAdmin(ADMIN_LOGIN, ADMIN_PASSWORD);
}
@Test
public void testGetAllProjectsAsAdmin() throws Exception {
MockHttpSession session = createSession(ADMIN_LOGIN, ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
createProject(TEST_PROJECT);
RequestBuilder request = get("/projects/")
......@@ -136,7 +131,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
public void testGrantPrivilege() throws Exception {
createProject(TEST_PROJECT);
MockHttpSession session = createSession(ADMIN_LOGIN, ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
String body = "[{"
+ "\"privilegeType\":\"" + PrivilegeType.READ_PROJECT + "\", "
......@@ -158,7 +153,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
Project project = createProject(TEST_PROJECT);
userService.grantUserPrivilege(curator, PrivilegeType.READ_PROJECT, project.getProjectId());
MockHttpSession session = createSession(ADMIN_LOGIN, ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
String body = "[{"
+ "\"privilegeType\":\"" + PrivilegeType.READ_PROJECT + "\", "
......@@ -177,7 +172,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testGetNonExistingProject() throws Exception {
MockHttpSession session = createSession(ADMIN_LOGIN, ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/*/")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
......@@ -189,7 +184,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testUpdateProject() throws Exception {
MockHttpSession session = createSession(ADMIN_LOGIN, ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
Project project = createProject(TEST_PROJECT);
String content = "{\"project\":{\"version\":\"xxx\"}}";
......@@ -208,7 +203,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testUpdateProjectWithTooLongVersion() throws Exception {
MockHttpSession session = createSession(ADMIN_LOGIN, ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
createProject(TEST_PROJECT);
String content = "{\"project\":{\"version\":\"12345678901234567890123456\"}}";
......@@ -224,7 +219,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testUpdateProjectWithUndefinedProjectId() throws Exception {
MockHttpSession session = createSession(ADMIN_LOGIN, ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
String content = "{\"project\":{\"version\":\"xxx\"}}";
......@@ -239,7 +234,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testGrantPrivilegeForUndefinedProject() throws Exception {
MockHttpSession session = createSession(ADMIN_LOGIN, ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
String body = "[{"
+ "\"privilegeType\":\"" + PrivilegeType.READ_PROJECT + "\", "
......@@ -256,7 +251,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testRevokePrivilegeForUndefinedProject() throws Exception {
MockHttpSession session = createSession(ADMIN_LOGIN, ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
String body = "[{"
+ "\"privilegeType\":\"" + PrivilegeType.READ_PROJECT + "\", "
......@@ -273,7 +268,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testRemoveProjectForUndefinedProjectId() throws Exception {
MockHttpSession session = createSession(ADMIN_LOGIN, ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = delete("/projects/*/")
.session(session);
......@@ -284,7 +279,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testGetStatisticsForUndefinedProjectId() throws Exception {
MockHttpSession session = createSession(ADMIN_LOGIN, ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/*/statistics")
.session(session);
......@@ -295,7 +290,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testDownloadSourceForUndefinedProjectId() throws Exception {
MockHttpSession session = createSession(ADMIN_LOGIN, ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/*:downloadSource")
.session(session);
......@@ -306,7 +301,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testGetLogsForUndefinedProjectId() throws Exception {
MockHttpSession session = createSession(ADMIN_LOGIN, ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/*/logs/")
.session(session);
......@@ -317,7 +312,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testGetSubmapConnectionsForUndefinedProjectId() throws Exception {
MockHttpSession session = createSession(ADMIN_LOGIN, ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/*/submapConnections/")
.session(session);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment