From d125e66c028df1d8e1755771ca8aca0e95c44acc Mon Sep 17 00:00:00 2001 From: Livio Bieri Date: Wed, 1 Nov 2023 14:02:46 +0100 Subject: [PATCH] fix: move utils.py outside of dashboard they are useful in other contexts too ;) --- .../utils.py => course/creators/test_utils.py} | 4 +++- .../dashboard/tests/graphql/test_assignment.py | 12 ++++++------ .../dashboard/tests/graphql/test_attendance.py | 6 +++--- .../dashboard/tests/graphql/test_competence.py | 6 +++--- .../dashboard/tests/graphql/test_dashboard.py | 6 +++--- .../dashboard/tests/graphql/test_feedback.py | 4 ++-- .../tests/graphql/test_selection_metrics.py | 4 ++-- 7 files changed, 22 insertions(+), 20 deletions(-) rename server/vbv_lernwelt/{dashboard/tests/graphql/utils.py => course/creators/test_utils.py} (99%) diff --git a/server/vbv_lernwelt/dashboard/tests/graphql/utils.py b/server/vbv_lernwelt/course/creators/test_utils.py similarity index 99% rename from server/vbv_lernwelt/dashboard/tests/graphql/utils.py rename to server/vbv_lernwelt/course/creators/test_utils.py index 0071c116..3f6bbc11 100644 --- a/server/vbv_lernwelt/dashboard/tests/graphql/utils.py +++ b/server/vbv_lernwelt/course/creators/test_utils.py @@ -252,7 +252,9 @@ def create_course_session_edoniq_test( def create_performance_criteria_page( - course: Course, course_page: CoursePage, circle: Circle + course: Course, + course_page: CoursePage, + circle: Circle, ) -> PerformanceCriteria: competence_navi_page = CompetenceNaviPageFactory( title="Competence Navi", diff --git a/server/vbv_lernwelt/dashboard/tests/graphql/test_assignment.py b/server/vbv_lernwelt/dashboard/tests/graphql/test_assignment.py index 734129d4..b02cfc7a 100644 --- a/server/vbv_lernwelt/dashboard/tests/graphql/test_assignment.py +++ b/server/vbv_lernwelt/dashboard/tests/graphql/test_assignment.py @@ -4,12 +4,7 @@ from typing import Tuple from graphene_django.utils import GraphQLTestCase from vbv_lernwelt.assignment.models import Assignment, AssignmentType -from vbv_lernwelt.course.models import CourseSession, CourseSessionUser -from vbv_lernwelt.course_session.models import ( - CourseSessionAssignment, - CourseSessionEdoniqTest, -) -from vbv_lernwelt.dashboard.tests.graphql.utils import ( +from vbv_lernwelt.course.creators.test_utils import ( add_course_session_group_supervisor, add_course_session_user, create_assignment, @@ -23,6 +18,11 @@ from vbv_lernwelt.dashboard.tests.graphql.utils import ( create_course_session_group, create_user, ) +from vbv_lernwelt.course.models import CourseSession, CourseSessionUser +from vbv_lernwelt.course_session.models import ( + CourseSessionAssignment, + CourseSessionEdoniqTest, +) from vbv_lernwelt.learnpath.models import Circle diff --git a/server/vbv_lernwelt/dashboard/tests/graphql/test_attendance.py b/server/vbv_lernwelt/dashboard/tests/graphql/test_attendance.py index e6738c83..a9f4e9f8 100644 --- a/server/vbv_lernwelt/dashboard/tests/graphql/test_attendance.py +++ b/server/vbv_lernwelt/dashboard/tests/graphql/test_attendance.py @@ -3,9 +3,7 @@ from datetime import timedelta from django.utils import timezone from graphene_django.utils import GraphQLTestCase -from vbv_lernwelt.course.models import CourseSessionUser -from vbv_lernwelt.course_session.services.attendance import AttendanceUserStatus -from vbv_lernwelt.dashboard.tests.graphql.utils import ( +from vbv_lernwelt.course.creators.test_utils import ( add_course_session_group_supervisor, add_course_session_user, create_attendance_course, @@ -15,6 +13,8 @@ from vbv_lernwelt.dashboard.tests.graphql.utils import ( create_course_session_group, create_user, ) +from vbv_lernwelt.course.models import CourseSessionUser +from vbv_lernwelt.course_session.services.attendance import AttendanceUserStatus class DashboardAttendanceTestCase(GraphQLTestCase): diff --git a/server/vbv_lernwelt/dashboard/tests/graphql/test_competence.py b/server/vbv_lernwelt/dashboard/tests/graphql/test_competence.py index bdcc6f66..9f5ae505 100644 --- a/server/vbv_lernwelt/dashboard/tests/graphql/test_competence.py +++ b/server/vbv_lernwelt/dashboard/tests/graphql/test_competence.py @@ -1,8 +1,6 @@ from graphene_django.utils import GraphQLTestCase -from vbv_lernwelt.course.models import CourseSessionUser -from vbv_lernwelt.course.services import mark_course_completion -from vbv_lernwelt.dashboard.tests.graphql.utils import ( +from vbv_lernwelt.course.creators.test_utils import ( add_course_session_group_supervisor, add_course_session_user, create_circle, @@ -12,6 +10,8 @@ from vbv_lernwelt.dashboard.tests.graphql.utils import ( create_performance_criteria_page, create_user, ) +from vbv_lernwelt.course.models import CourseSessionUser +from vbv_lernwelt.course.services import mark_course_completion class DashboardCompetenceTestCase(GraphQLTestCase): diff --git a/server/vbv_lernwelt/dashboard/tests/graphql/test_dashboard.py b/server/vbv_lernwelt/dashboard/tests/graphql/test_dashboard.py index 6b4c57df..5a8e0e40 100644 --- a/server/vbv_lernwelt/dashboard/tests/graphql/test_dashboard.py +++ b/server/vbv_lernwelt/dashboard/tests/graphql/test_dashboard.py @@ -1,9 +1,7 @@ from graphene_django.utils import GraphQLTestCase from vbv_lernwelt.assignment.models import AssignmentType -from vbv_lernwelt.course.models import CourseSessionUser -from vbv_lernwelt.course.services import mark_course_completion -from vbv_lernwelt.dashboard.tests.graphql.utils import ( +from vbv_lernwelt.course.creators.test_utils import ( add_course_session_group_supervisor, add_course_session_user, create_assignment, @@ -15,6 +13,8 @@ from vbv_lernwelt.dashboard.tests.graphql.utils import ( create_performance_criteria_page, create_user, ) +from vbv_lernwelt.course.models import CourseSessionUser +from vbv_lernwelt.course.services import mark_course_completion class DashboardTestCase(GraphQLTestCase): diff --git a/server/vbv_lernwelt/dashboard/tests/graphql/test_feedback.py b/server/vbv_lernwelt/dashboard/tests/graphql/test_feedback.py index 824f1772..19132975 100644 --- a/server/vbv_lernwelt/dashboard/tests/graphql/test_feedback.py +++ b/server/vbv_lernwelt/dashboard/tests/graphql/test_feedback.py @@ -1,7 +1,6 @@ from graphene_django.utils import GraphQLTestCase -from vbv_lernwelt.course.models import CourseSessionUser -from vbv_lernwelt.dashboard.tests.graphql.utils import ( +from vbv_lernwelt.course.creators.test_utils import ( add_course_session_group_supervisor, add_course_session_user, create_circle, @@ -10,6 +9,7 @@ from vbv_lernwelt.dashboard.tests.graphql.utils import ( create_course_session_group, create_user, ) +from vbv_lernwelt.course.models import CourseSessionUser from vbv_lernwelt.feedback.models import FeedbackResponse diff --git a/server/vbv_lernwelt/dashboard/tests/graphql/test_selection_metrics.py b/server/vbv_lernwelt/dashboard/tests/graphql/test_selection_metrics.py index c290aec5..55213cd9 100644 --- a/server/vbv_lernwelt/dashboard/tests/graphql/test_selection_metrics.py +++ b/server/vbv_lernwelt/dashboard/tests/graphql/test_selection_metrics.py @@ -1,7 +1,6 @@ from graphene_django.utils import GraphQLTestCase -from vbv_lernwelt.course.models import CourseSessionUser -from vbv_lernwelt.dashboard.tests.graphql.utils import ( +from vbv_lernwelt.course.creators.test_utils import ( add_course_session_group_course_session, add_course_session_group_supervisor, add_course_session_user, @@ -10,6 +9,7 @@ from vbv_lernwelt.dashboard.tests.graphql.utils import ( create_course_session_group, create_user, ) +from vbv_lernwelt.course.models import CourseSessionUser class DashboardTestCase(GraphQLTestCase):