fix: make test more robust ;)

This commit is contained in:
Livio Bieri 2024-02-02 18:52:06 +01:00
parent bd3f2a4513
commit a921d5f548
1 changed files with 10 additions and 5 deletions

View File

@ -433,10 +433,11 @@ class SelfEvaluationFeedbackAPI(APITestCase):
def test_get_self_evaluation_feedback_frontend_urls(self):
"""Makes sure that the frontend urls are correct (used in notifications)"""
# GIVEN
learning_unit = create_learning_unit(course=self.course, circle=self.circle)
cut = create_self_evaluation_feedback(
learning_unit=create_learning_unit(course=self.course, circle=self.circle),
learning_unit=learning_unit,
feedback_requester_user=self.member,
feedback_provider_user=self.mentor,
)
@ -446,13 +447,17 @@ class SelfEvaluationFeedbackAPI(APITestCase):
provider_url = cut.feedback_provider_evaluation_url
# THEN
_course, _circle, _learning_unit = learning_unit.get_frontend_url_parts()
# 0 -> no completions so step=0 is correct
_step = len(learning_unit.performancecriteria_set.all())
self.assertEqual(
requester_url,
# 0 -> no completions so step=0 is correct
"/course/test-lehrgang/learn/test-circle/evaluate/course-category?step=0",
f"/course/{_course}/learn/{_circle}/evaluate/{_learning_unit}?step={_step}",
)
self.assertEqual(
provider_url,
"/course/test-lehrgang/cockpit/mentor/self-evaluation-feedback/34",
f"/course/{_course}/cockpit/mentor/self-evaluation-feedback/{learning_unit.id}",
)