Fixed old tests

This commit is contained in:
Filip Izydorczyk 2020-10-24 16:43:42 +02:00
parent 4b07793849
commit c003198aa1
2 changed files with 3 additions and 18 deletions

View File

@ -11,7 +11,6 @@ import com.plannaplan.entities.User;
import com.plannaplan.exceptions.UserNotFoundException;
import com.plannaplan.types.UserRoles;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
@ -29,14 +28,10 @@ public class UserServiceTest {
@Autowired
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
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 {
final String token = this.userService.login(TEST_USER_MAIL);
System.out.println("Returned token: " + token);

View File

@ -37,16 +37,6 @@ public class ConfigControllerTest {
@Autowired
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
public void shouldReturnNoAuthorized() throws Exception {
final InputStream inputStream = getClass().getClassLoader().getResourceAsStream(FILE_NAME);
@ -59,7 +49,7 @@ public class ConfigControllerTest {
@Test
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);
final InputStream inputStream = getClass().getClassLoader().getResourceAsStream(FILE_NAME);