Changed token response in controller
This commit is contained in:
buisnesslogic/src
restservice/src
main
java
com
plannaplan
controllers
test
java
@ -37,7 +37,7 @@ public class AssignmentsControllerTest extends AbstractControllerTest {
|
||||
@Test
|
||||
public void shouldReturnOk() throws Exception {
|
||||
final User newuser = this.service.save(new User(null, null, TEST_MAIL, UserRoles.TEST_USER));
|
||||
final String token = this.service.login(newuser);
|
||||
final String token = this.service.login(newuser).getToken();
|
||||
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
|
||||
mockMvc.perform(get(ASSIGFNMENTS_ENDPOINT).header("Authorization", "Bearer " + token))
|
||||
|
@ -58,7 +58,7 @@ public class CommisionControllerTest extends AbstractControllerTest {
|
||||
public void shouldFailedAddingCommisionDueToNoArgs() throws Exception {
|
||||
this.checkUsers();
|
||||
final User user = this.service.checkForUser(TEST_COMMISIONS_STUDENT_EMAIL, null);
|
||||
final String token = this.service.login(user);
|
||||
final String token = this.service.login(user).getToken();
|
||||
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
|
||||
mockMvc.perform(post(ADD_COMMISION_ENDPOINT).header("Authorization", "Bearer " + token))
|
||||
@ -69,7 +69,7 @@ public class CommisionControllerTest extends AbstractControllerTest {
|
||||
public void shouldReturnOkAddingCommision() throws Exception {
|
||||
this.checkUsers();
|
||||
final User user = this.service.checkForUser(TEST_COMMISIONS_STUDENT_EMAIL, null);
|
||||
final String token = this.service.login(user);
|
||||
final String token = this.service.login(user).getToken();
|
||||
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
|
||||
mockMvc.perform(post(ADD_COMMISION_ENDPOINT).header("Authorization", "Bearer " + token)
|
||||
@ -86,7 +86,7 @@ public class CommisionControllerTest extends AbstractControllerTest {
|
||||
public void shouldReturnOkGettingAllCommisions() throws Exception {
|
||||
this.checkUsers();
|
||||
final User user = this.service.checkForUser(TEST_COMMISIONS_STUDENT_EMAIL, null);
|
||||
final String token = this.service.login(user);
|
||||
final String token = this.service.login(user).getToken();
|
||||
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
|
||||
mockMvc.perform(get(GET_COMMISIONS_ENDPOINT).header("Authorization", "Bearer " + token))
|
||||
@ -97,7 +97,7 @@ public class CommisionControllerTest extends AbstractControllerTest {
|
||||
public void shouldAddCommisionWithSelfIdPrivided() throws Exception {
|
||||
this.checkUsers();
|
||||
final User user = this.service.checkForUser(TEST_COMMISIONS_STUDENT_EMAIL, null);
|
||||
final String token = this.service.login(user);
|
||||
final String token = this.service.login(user).getToken();
|
||||
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
|
||||
mockMvc.perform(post(ADD_COMMISION_ENDPOINT + "/" + CommisionControllerTest.user.getId().toString())
|
||||
@ -110,7 +110,7 @@ public class CommisionControllerTest extends AbstractControllerTest {
|
||||
this.checkUsers();
|
||||
|
||||
final User user = this.service.checkForUser(TEST_COMMISIONS_STUDENT_EMAIL, null);
|
||||
final String token = this.service.login(user);
|
||||
final String token = this.service.login(user).getToken();
|
||||
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
|
||||
mockMvc.perform(post(ADD_COMMISION_ENDPOINT + "/" + CommisionControllerTest.otherUser.getId().toString())
|
||||
@ -122,7 +122,7 @@ public class CommisionControllerTest extends AbstractControllerTest {
|
||||
public void shouldFailCommisionAsDeanaryWithNoId() throws Exception {
|
||||
this.checkUsers();
|
||||
final User user = this.service.checkForUser(TEST_COMMISIONS_DEANERY_EMAIL, null);
|
||||
final String token = this.service.login(user);
|
||||
final String token = this.service.login(user).getToken();
|
||||
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
|
||||
mockMvc.perform(post(ADD_COMMISION_ENDPOINT).header("Authorization", "Bearer " + token)
|
||||
@ -132,7 +132,7 @@ public class CommisionControllerTest extends AbstractControllerTest {
|
||||
@Test
|
||||
public void shouldFailCommisionWithSelfIdPrividedAsDeanary() throws Exception {
|
||||
final User user = this.service.checkForUser(TEST_COMMISIONS_DEANERY_EMAIL, null);
|
||||
final String token = this.service.login(user);
|
||||
final String token = this.service.login(user).getToken();
|
||||
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
|
||||
mockMvc.perform(post(ADD_COMMISION_ENDPOINT + "/" + CommisionControllerTest.asker.getId().toString())
|
||||
@ -145,7 +145,7 @@ public class CommisionControllerTest extends AbstractControllerTest {
|
||||
this.checkUsers();
|
||||
|
||||
final User user = this.service.checkForUser(TEST_COMMISIONS_DEANERY_EMAIL, null);
|
||||
final String token = this.service.login(user);
|
||||
final String token = this.service.login(user).getToken();
|
||||
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
|
||||
mockMvc.perform(post(ADD_COMMISION_ENDPOINT + "/" + CommisionControllerTest.otherUser.getId().toString())
|
||||
@ -158,7 +158,7 @@ public class CommisionControllerTest extends AbstractControllerTest {
|
||||
this.checkUsers();
|
||||
|
||||
final User user = this.service.checkForUser(TEST_COMMISIONS_DEANERY_EMAIL, null);
|
||||
final String token = this.service.login(user);
|
||||
final String token = this.service.login(user).getToken();
|
||||
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
|
||||
mockMvc.perform(post(ADD_COMMISION_ENDPOINT + "/" + CommisionControllerTest.otherAsker.getId().toString())
|
||||
@ -171,7 +171,7 @@ public class CommisionControllerTest extends AbstractControllerTest {
|
||||
this.checkUsers();
|
||||
|
||||
final User user = this.service.checkForUser(TEST_COMMISIONS_DEANERY_EMAIL, null);
|
||||
final String token = this.service.login(user);
|
||||
final String token = this.service.login(user).getToken();
|
||||
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
|
||||
mockMvc.perform(get(GET_SOMEONE_COMMISIONS_ENDPOINT + "/" + CommisionControllerTest.user.getId().toString())
|
||||
@ -181,9 +181,9 @@ public class CommisionControllerTest extends AbstractControllerTest {
|
||||
@Test
|
||||
public void shouldFailStudentCommisionsListByOtherStudent() throws Exception {
|
||||
this.checkUsers();
|
||||
|
||||
|
||||
final User user = this.service.checkForUser(TEST_COMMISIONS_STUDENT_EMAIL, null);
|
||||
final String token = this.service.login(user);
|
||||
final String token = this.service.login(user).getToken();
|
||||
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
|
||||
mockMvc.perform(get(GET_SOMEONE_COMMISIONS_ENDPOINT + "/" + CommisionControllerTest.user.getId().toString())
|
||||
|
@ -49,7 +49,7 @@ public class ConfigControllerTest extends AbstractControllerTest {
|
||||
|
||||
final InputStream inputStream = getClass().getClassLoader().getResourceAsStream(FILE_NAME);
|
||||
final MockMultipartFile file = new MockMultipartFile("file", inputStream);
|
||||
final String token = this.service.login(usr);
|
||||
final String token = this.service.login(usr).getToken();
|
||||
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
|
||||
mockMvc.perform(multipart(CONFIG_ENDPOINT).file(file).header("Authorization", "Bearer " + token))
|
||||
@ -64,7 +64,7 @@ public class ConfigControllerTest extends AbstractControllerTest {
|
||||
|
||||
final InputStream inputStream = getClass().getClassLoader().getResourceAsStream(FILE_NAME);
|
||||
final MockMultipartFile file = new MockMultipartFile("file", inputStream);
|
||||
final String token = this.service.login(usr);
|
||||
final String token = this.service.login(usr).getToken();
|
||||
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
|
||||
mockMvc.perform(multipart(CONFIG_ENDPOINT).file(file).header("Authorization", "Bearer " + token))
|
||||
|
@ -31,7 +31,7 @@ public class UsersControllerTest extends AbstractControllerTest {
|
||||
public void shouldRestrun200OK() throws Exception {
|
||||
final String email = "notexistingassignmentuser@shouldRestrun200OK.test";
|
||||
final User user = this.service.save(new User(null, null, email, UserRoles.DEANERY));
|
||||
final String token = this.service.login(user);
|
||||
final String token = this.service.login(user).getToken();
|
||||
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
|
||||
mockMvc.perform(get(ENDPOINT).param("query", "").header("Authorization", "Bearer " + token))
|
||||
@ -48,7 +48,7 @@ public class UsersControllerTest extends AbstractControllerTest {
|
||||
public void shouldFailedDueToMissingParam() throws Exception {
|
||||
final String email = "notexistingassignmentuser@shouldFailedDueToMissingParam.test";
|
||||
final User user = this.service.save(new User(null, null, email, UserRoles.DEANERY));
|
||||
final String token = this.service.login(user);
|
||||
final String token = this.service.login(user).getToken();
|
||||
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
|
||||
mockMvc.perform(get(ENDPOINT).header("Authorization", "Bearer " + token))
|
||||
|
Reference in New Issue
Block a user