Fix tests
This commit is contained in:
parent
010d91131e
commit
ffefb5a72e
@ -3,7 +3,7 @@ Authorization: Bearer {{auth_token}}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"firstName": "Jan1",
|
||||
"firstName": "Jan12",
|
||||
"lastName": "Klattenhoff1",
|
||||
"street": "Pirolweg 171",
|
||||
"postcode": "27777",
|
||||
|
@ -2,7 +2,6 @@ package de.szut.lf8_starter.integration.project;
|
||||
|
||||
import de.szut.lf8_starter.project.ProjectEntity;
|
||||
import de.szut.lf8_starter.project.ProjectRepository;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
@ -32,13 +31,10 @@ class AddEmployeeToProjectTest {
|
||||
@Autowired
|
||||
private ProjectRepository projectRepository;
|
||||
|
||||
@BeforeEach
|
||||
public void clear() {
|
||||
this.projectRepository.deleteAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
void addEmployeeToProjectTest() throws Exception {
|
||||
this.projectRepository.deleteAll();
|
||||
|
||||
ProjectEntity project = new ProjectEntity();
|
||||
project.setComment("comment");
|
||||
project.setContractor(1);
|
||||
@ -60,6 +56,7 @@ class AddEmployeeToProjectTest {
|
||||
assert updatedProject.getEmployees().contains(312L);
|
||||
}
|
||||
|
||||
|
||||
private String getBearerToken() {
|
||||
String url = "https://keycloak.szut.dev/auth/realms/szut/protocol/openid-connect/token";
|
||||
|
||||
|
@ -3,7 +3,6 @@ package de.szut.lf8_starter.integration.project;
|
||||
import de.szut.lf8_starter.project.ProjectEntity;
|
||||
import de.szut.lf8_starter.project.ProjectRepository;
|
||||
import org.json.JSONObject;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
@ -36,13 +35,10 @@ class CreateProjectActionTest {
|
||||
@Autowired
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@BeforeEach
|
||||
public void clear() {
|
||||
this.projectRepository.deleteAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
void createProjectTest() throws Exception {
|
||||
this.projectRepository.deleteAll();
|
||||
|
||||
String content = """
|
||||
{
|
||||
"name": "name",
|
||||
|
@ -42,7 +42,7 @@ class GetEmployeesFromProjectTest {
|
||||
project.setLeadingEmployee(1);
|
||||
project.setName("name");
|
||||
project.setStartDate(LocalDate.of(2021, 1, 1));
|
||||
project.setEmployees(List.of(315L));
|
||||
project.setEmployees(List.of(316L));
|
||||
this.projectRepository.save(project);
|
||||
|
||||
this.mockMvc.perform(get("/projects/1/employees")
|
||||
@ -50,7 +50,7 @@ class GetEmployeesFromProjectTest {
|
||||
).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("project_id").value(1))
|
||||
.andExpect(jsonPath("project_description").value("comment"))
|
||||
.andExpect(jsonPath("employees[0].id").value(315))
|
||||
.andExpect(jsonPath("employees[0].id").value(316))
|
||||
.andExpect(jsonPath("employees[0].skillSet[0].skill").value("Product Owner"));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user