From a8c09651db16e43a3dce682fd7d5f55529b8edad Mon Sep 17 00:00:00 2001 From: Reto Aebersold Date: Mon, 15 Jan 2024 14:39:17 +0100 Subject: [PATCH] chore: hide profile links and add profile test --- .../profilePage/LearningPathProfilePage.vue | 1 + .../circlePage/LearningSequence.vue | 7 +-- server/vbv_lernwelt/api/tests/test_profile.py | 60 +++++++++++++++++++ 3 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 server/vbv_lernwelt/api/tests/test_profile.py diff --git a/client/src/pages/cockpit/profilePage/LearningPathProfilePage.vue b/client/src/pages/cockpit/profilePage/LearningPathProfilePage.vue index c4bbfb9b..c094e729 100644 --- a/client/src/pages/cockpit/profilePage/LearningPathProfilePage.vue +++ b/client/src/pages/cockpit/profilePage/LearningPathProfilePage.vue @@ -64,6 +64,7 @@ watch(lpQueryResult.learningPath, () => { :circle="selectedCircle" :learning-sequence="learningSequence" readonly + hide-links > diff --git a/client/src/pages/learningPath/circlePage/LearningSequence.vue b/client/src/pages/learningPath/circlePage/LearningSequence.vue index 2f52f837..2457c591 100644 --- a/client/src/pages/learningPath/circlePage/LearningSequence.vue +++ b/client/src/pages/learningPath/circlePage/LearningSequence.vue @@ -32,6 +32,7 @@ type Props = { learningSequence: LearningSequence; circle: CircleType; readonly?: boolean; + hideLinks?: boolean; }; const props = withDefaults(defineProps(), { @@ -229,7 +230,7 @@ function checkboxIconUncheckedTailwindClass(lc: LearningContent) {
{{ @@ -298,11 +299,7 @@ function checkboxIconUncheckedTailwindClass(lc: LearningContent) {
{{ $t("a.Selbsteinschätzung") }}
- - - - diff --git a/server/vbv_lernwelt/api/tests/test_profile.py b/server/vbv_lernwelt/api/tests/test_profile.py new file mode 100644 index 00000000..4c73b50e --- /dev/null +++ b/server/vbv_lernwelt/api/tests/test_profile.py @@ -0,0 +1,60 @@ +from django.urls import reverse +from rest_framework import status +from rest_framework.test import APITestCase + +from vbv_lernwelt.course.creators.test_utils import ( + add_course_session_user, + create_course, + create_course_session, + create_user, +) +from vbv_lernwelt.course.models import CourseSessionUser + + +class ProfileViewTest(APITestCase): + def setUp(self) -> None: + self.course, _ = create_course("Test Course") + self.course_session = create_course_session( + course=self.course, title="Test Session" + ) + + self.user = create_user("user") + add_course_session_user( + self.course_session, + self.user, + role=CourseSessionUser.Role.MEMBER, + ) + + self.client.force_login(self.user) + + def test_user_profile(self) -> None: + # GIVEN + url = reverse( + "get_profile_view", + kwargs={ + "course_session_id": self.course_session.id, + "user_id": self.user.id, + }, + ) + + # WHEN + response = self.client.get(url) + + # THEN + self.assertEqual(response.status_code, status.HTTP_200_OK) + profile = response.data + self.assertEqual( + profile, + { + "id": str(self.user.id), + "first_name": self.user.first_name, + "last_name": self.user.last_name, + "email": self.user.email, + "username": self.user.username, + "avatar_url": "/static/avatars/myvbv-default-avatar.png", + "organisation": None, + "is_superuser": False, + "course_session_experts": [], + "language": "de", + }, + )