diff --git a/backend/src/test/kotlin/be/osoc/team1/backend/unittests/ProjectServiceTests.kt b/backend/src/test/kotlin/be/osoc/team1/backend/unittests/ProjectServiceTests.kt index 02a67cc1..267d6726 100644 --- a/backend/src/test/kotlin/be/osoc/team1/backend/unittests/ProjectServiceTests.kt +++ b/backend/src/test/kotlin/be/osoc/team1/backend/unittests/ProjectServiceTests.kt @@ -33,6 +33,7 @@ import org.springframework.web.context.request.ServletRequestAttributes import java.util.UUID class ProjectServiceTests { + private val scheme = System.getenv("OSOC_SCHEME") ?: "http" private val testId = UUID.randomUUID() private val testStudent = Student("Lars", "Van Cauter", "") private val testCoach = User("Lars2 Van Cauter", "lars2@email.com", Role.Coach, "password") @@ -219,7 +220,7 @@ class ProjectServiceTests { val service = ProjectService(repository, mockk(), getUserService()) val mockRequest = MockHttpServletRequest() - mockRequest.scheme = "http" + mockRequest.scheme = scheme mockRequest.serverName = "example.com" mockRequest.serverPort = -1 mockRequest.contextPath = "/api" @@ -227,19 +228,19 @@ class ProjectServiceTests { val conflictList = service.getConflicts(testEdition) assert( conflictList[0] == ProjectService.Conflict( - "http://example.com/api/$testEdition/students/" + testStudent.id, + "$scheme://example.com/api/$testEdition/students/" + testStudent.id, mutableListOf( - "http://example.com/api/$testEdition/projects/" + testProjectConflict.id, - "http://example.com/api/$testEdition/projects/" + testProjectConflict2.id + "$scheme://example.com/api/$testEdition/projects/" + testProjectConflict.id, + "$scheme://example.com/api/$testEdition/projects/" + testProjectConflict2.id ) ) ) assert( conflictList[1] == ProjectService.Conflict( - "http://example.com/api/$testEdition/students/" + testStudent2.id, + "$scheme://example.com/api/$testEdition/students/" + testStudent2.id, mutableListOf( - "http://example.com/api/$testEdition/projects/" + testProjectConflict2.id, - "http://example.com/api/$testEdition/projects/" + testProjectConflict3.id + "$scheme://example.com/api/$testEdition/projects/" + testProjectConflict2.id, + "$scheme://example.com/api/$testEdition/projects/" + testProjectConflict3.id ) ) ) diff --git a/backend/src/test/kotlin/be/osoc/team1/backend/unittests/SerializationTests.kt b/backend/src/test/kotlin/be/osoc/team1/backend/unittests/SerializationTests.kt index 51c91d43..4aee64df 100644 --- a/backend/src/test/kotlin/be/osoc/team1/backend/unittests/SerializationTests.kt +++ b/backend/src/test/kotlin/be/osoc/team1/backend/unittests/SerializationTests.kt @@ -25,6 +25,7 @@ import org.springframework.web.context.request.ServletRequestAttributes @JsonTest class SerializationTests { + private val scheme = System.getenv("OSOC_SCHEME") ?: "http" @Autowired private val projectJacksonTester: JacksonTester? = null @@ -61,11 +62,11 @@ class SerializationTests { val json: JsonContent = projectJacksonTester!!.write(testProject) assertThat(json).extractingJsonPathValue("$.coaches") - .isEqualTo(mutableListOf("http://example.com/api/users/${testUser.id}")) + .isEqualTo(mutableListOf("$scheme://example.com/api/users/${testUser.id}")) assertThat(json).extractingJsonPathValue("$.positions") - .isEqualTo(mutableListOf("http://example.com/api/positions/${testPosition.id}")) + .isEqualTo(mutableListOf("$scheme://example.com/api/positions/${testPosition.id}")) assertThat(json).extractingJsonPathValue("$.assignments") - .isEqualTo(mutableListOf("http://example.com/api/assignments/${testAssignment.id}")) + .isEqualTo(mutableListOf("$scheme://example.com/api/assignments/${testAssignment.id}")) } @Test @@ -89,9 +90,9 @@ class SerializationTests { val json: JsonContent = studentJacksonTester!!.write(testStudent) assertThat(json).extractingJsonPathValue("$.statusSuggestions") - .isEqualTo(mutableListOf("http://example.com/api/statusSuggestions/${testStatusSuggestion.id}")) + .isEqualTo(mutableListOf("$scheme://example.com/api/statusSuggestions/${testStatusSuggestion.id}")) assertThat(json).extractingJsonPathValue("$.communications") - .isEqualTo(mutableListOf("http://example.com/api/$testEdition/communications/${testCommunication.id}")) + .isEqualTo(mutableListOf("$scheme://example.com/api/$testEdition/communications/${testCommunication.id}")) } @Test @@ -113,10 +114,10 @@ class SerializationTests { val json: JsonContent = assignmentJacksonTester!!.write(testAssignment) assertThat(json).extractingJsonPathValue("$.student") - .isEqualTo("http://example.com/api/$testEdition/students/${testStudent.id}") + .isEqualTo("$scheme://example.com/api/$testEdition/students/${testStudent.id}") assertThat(json).extractingJsonPathValue("$.position") - .isEqualTo("http://example.com/api/positions/${testPosition.id}") + .isEqualTo("$scheme://example.com/api/positions/${testPosition.id}") assertThat(json).extractingJsonPathValue("$.suggester") - .isEqualTo("http://example.com/api/users/${testSuggester.id}") + .isEqualTo("$scheme://example.com/api/users/${testSuggester.id}") } }