Skip to content

Commit

Permalink
fix further tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulBredl committed Jun 28, 2024
1 parent 69a8253 commit 770ee2f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class AuthorizationTest {


@Test
void testCreateCourseCourseCreatorOnly(final HttpGraphQlTester tester) {
void testCreateCourseCourseCreatorOnly(WebGraphQlTester tester) {

final String query = """
mutation {
Expand Down Expand Up @@ -80,7 +80,7 @@ public static void assertIsMissingGlobalPermission(final List<ResponseError> gra

@Test
@Transactional
void testUpdateCourseAdminOnly(final HttpGraphQlTester tester) {
void testUpdateCourseAdminOnly(WebGraphQlTester tester) {

final String query = """
mutation {
Expand Down Expand Up @@ -120,7 +120,7 @@ void testUpdateCourseAdminOnly(final HttpGraphQlTester tester) {
}

@Test
void testDeleteCourseAdminOnly(final HttpGraphQlTester tester) {
void testDeleteCourseAdminOnly(WebGraphQlTester tester) {

final String query = """
mutation {
Expand All @@ -135,7 +135,7 @@ void testDeleteCourseAdminOnly(final HttpGraphQlTester tester) {
}

@Test
void testCreateChapterAdminOnly(final HttpGraphQlTester tester) {
void testCreateChapterAdminOnly(WebGraphQlTester tester) {

final String query = """
mutation {
Expand Down Expand Up @@ -165,7 +165,7 @@ void testCreateChapterAdminOnly(final HttpGraphQlTester tester) {
}

@Test
void testUpdateChapterAdminOnly(final HttpGraphQlTester tester) {
void testUpdateChapterAdminOnly(WebGraphQlTester tester) {

final ChapterEntity chapterEntity = chapterRepository.save(TestUtils.dummyChapterBuilder().courseId(courseId).build());

Expand Down Expand Up @@ -226,7 +226,7 @@ void testDeleteChapterAdminOnly(WebGraphQlTester tester) {


@Test
void testCreateMembershipAdminOnly(final HttpGraphQlTester tester) {
void testCreateMembershipAdminOnly(WebGraphQlTester tester) {

final CourseMembership expectedDto = CourseMembership.builder()
.setUserId(UUID.randomUUID())
Expand Down Expand Up @@ -257,7 +257,7 @@ void testCreateMembershipAdminOnly(final HttpGraphQlTester tester) {
}

@Test
void testUpdateMembershipAdminOnly(final HttpGraphQlTester tester) {
void testUpdateMembershipAdminOnly(WebGraphQlTester tester) {

final CourseMembership expectedDto = CourseMembership.builder()
.setUserId(currentUser.getId())
Expand Down Expand Up @@ -288,7 +288,7 @@ void testUpdateMembershipAdminOnly(final HttpGraphQlTester tester) {
}

@Test
void testDeleteMembershipAdminOnly(final HttpGraphQlTester tester) {
void testDeleteMembershipAdminOnly(WebGraphQlTester tester) {

final CourseMembership expectedDto = CourseMembership.builder()
.setUserId(currentUser.getId())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package de.unistuttgart.iste.meitrex.course_service.api;

import de.unistuttgart.iste.meitrex.common.testutil.*;
import de.unistuttgart.iste.meitrex.common.testutil.GraphQlApiTest;
import de.unistuttgart.iste.meitrex.common.testutil.InjectCurrentUserHeader;
import de.unistuttgart.iste.meitrex.common.testutil.MockTestPublisherConfiguration;
import de.unistuttgart.iste.meitrex.common.user_handling.LoggedInUser;
import de.unistuttgart.iste.meitrex.course_service.persistence.repository.ChapterRepository;
import de.unistuttgart.iste.meitrex.course_service.persistence.repository.CourseRepository;
Expand All @@ -9,6 +11,7 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.graphql.test.tester.GraphQlTester;
import org.springframework.graphql.test.tester.WebGraphQlTester;
import org.springframework.test.context.ContextConfiguration;

import java.time.OffsetDateTime;
Expand Down Expand Up @@ -42,7 +45,7 @@ class MutationCreateCourseTest {
* Then the course is created and returned
*/
@Test
void testCreateCourse(final HttpGraphQlTester tester) {
void testCreateCourse(WebGraphQlTester tester) {
final String query = """
mutation {
createCourse(
Expand Down Expand Up @@ -99,7 +102,7 @@ void testCreateCourse(final HttpGraphQlTester tester) {
* Then the course is created and returned
*/
@Test
void testCreateCourseWithTerm(final HttpGraphQlTester tester) {
void testCreateCourseWithTerm(GraphQlTester tester) {
final String query = """
mutation {
createCourse(
Expand Down Expand Up @@ -253,7 +256,7 @@ void testTooLongDescription(final GraphQlTester tester) {
* Then a validation error is returned
*/
@Test
void testStartDateAfterEndDate(final HttpGraphQlTester tester) {
void testStartDateAfterEndDate(WebGraphQlTester tester) {
final String query = """
mutation {
createCourse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import de.unistuttgart.iste.meitrex.generated.dto.UserRoleInCourse;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.graphql.test.tester.WebGraphQlTester;

import java.time.OffsetDateTime;
import java.util.UUID;
Expand All @@ -29,7 +30,7 @@ class MutationJoinCourseTest {
private final UUID currentUserId = UUID.randomUUID();

@Test
void testJoinCourse(final HttpGraphQlTester tester) {
void testJoinCourse(WebGraphQlTester tester) {
final CourseEntity course = courseRepository.save(CourseEntity.builder().title("Course 1")
.description("This is course 1")
.startDate(OffsetDateTime.parse("2020-01-01T00:00:00.000Z"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.graphql.test.tester.WebGraphQlTester;

import java.time.OffsetDateTime;
import java.util.UUID;
Expand All @@ -28,7 +29,7 @@ class MutationLeaveCourseTest {
private final UUID currentUserId = UUID.randomUUID();

@Test
void testLeaveCourse(final HttpGraphQlTester tester) {
void testLeaveCourse(WebGraphQlTester tester) {
final CourseEntity course = courseRepository.save(CourseEntity.builder().title("Course 1")
.description("This is course 1")
.startDate(OffsetDateTime.parse("2020-01-01T00:00:00.000Z"))
Expand Down

0 comments on commit 770ee2f

Please sign in to comment.