Fixed old tests
This commit is contained in:
parent
4b07793849
commit
c003198aa1
@ -11,7 +11,6 @@ import com.plannaplan.entities.User;
|
|||||||
import com.plannaplan.exceptions.UserNotFoundException;
|
import com.plannaplan.exceptions.UserNotFoundException;
|
||||||
import com.plannaplan.types.UserRoles;
|
import com.plannaplan.types.UserRoles;
|
||||||
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.jupiter.api.TestMethodOrder;
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||||
@ -29,14 +28,10 @@ public class UserServiceTest {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
@Before
|
|
||||||
public void initialize() {
|
|
||||||
User testUser = new User(TEST_USER_NAME, TEST_USER_SUERNAME, TEST_USER_MAIL, UserRoles.TEST_USER);
|
|
||||||
this.userService.save(testUser);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldReturnToken() {
|
public void shouldReturnToken() {
|
||||||
|
final User testUser = new User(TEST_USER_NAME, TEST_USER_SUERNAME, TEST_USER_MAIL, UserRoles.TEST_USER);
|
||||||
|
this.userService.save(testUser);
|
||||||
try {
|
try {
|
||||||
final String token = this.userService.login(TEST_USER_MAIL);
|
final String token = this.userService.login(TEST_USER_MAIL);
|
||||||
System.out.println("Returned token: " + token);
|
System.out.println("Returned token: " + token);
|
||||||
|
@ -37,16 +37,6 @@ public class ConfigControllerTest {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private UserService service;
|
private UserService service;
|
||||||
|
|
||||||
@Test
|
|
||||||
public void shouldReturnOK() throws Exception {
|
|
||||||
final InputStream inputStream = getClass().getClassLoader().getResourceAsStream(FILE_NAME);
|
|
||||||
final MockMultipartFile file = new MockMultipartFile("file", inputStream);
|
|
||||||
|
|
||||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
|
|
||||||
mockMvc.perform(multipart(CONFIG_ENDPOINT).file(file)).andExpect(status().isOk());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldReturnNoAuthorized() throws Exception {
|
public void shouldReturnNoAuthorized() throws Exception {
|
||||||
final InputStream inputStream = getClass().getClassLoader().getResourceAsStream(FILE_NAME);
|
final InputStream inputStream = getClass().getClassLoader().getResourceAsStream(FILE_NAME);
|
||||||
@ -59,7 +49,7 @@ public class ConfigControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldReturnOKAuthorized() throws Exception {
|
public void shouldReturnOKAuthorized() throws Exception {
|
||||||
final User usr = new User(null, null, TEST_MAIL, UserRoles.TEST_USER);
|
final User usr = new User(null, null, TEST_MAIL, UserRoles.ADMIN);
|
||||||
this.service.save(usr);
|
this.service.save(usr);
|
||||||
|
|
||||||
final InputStream inputStream = getClass().getClassLoader().getResourceAsStream(FILE_NAME);
|
final InputStream inputStream = getClass().getClassLoader().getResourceAsStream(FILE_NAME);
|
||||||
|
Loading…
Reference in New Issue
Block a user