Skip to content

Commit

Permalink
Added test case for course id not found for standalone mode
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbaldwin committed Sep 22, 2020
1 parent bdef2c6 commit ef297f0
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tests/views/test_learner_metrics_viewset.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from rest_framework import status
from rest_framework.test import APIRequestFactory, force_authenticate

from figures.helpers import as_course_key
from figures.sites import get_user_ids_for_site
from figures.views import LearnerMetricsViewSet

Expand Down Expand Up @@ -209,7 +210,9 @@ def test_valid_and_course_param_from_other_site_invalid(self,
lm_test_data,
query_params)

def test_valid_and_mangled_course_param_invalid(self, monkeypatch, lm_test_data):
def test_valid_and_mangled_course_param_invalid(self,
monkeypatch,
lm_test_data):
"""Test that the 'course' query parameter works
"""
Expand All @@ -220,3 +223,15 @@ def test_valid_and_mangled_course_param_invalid(self, monkeypatch, lm_test_data)
assert self.invalid_course_ids_raise_404(monkeypatch,
lm_test_data,
query_params)

def test_unlinked_course_id_param_invalid(self, monkeypatch, lm_test_data):
"""Test that the 'course' query parameter works
"""
our_courses = lm_test_data['us']['courses']
unlinked_course_id = as_course_key('course-v1:UnlinkedCourse+UMK+1999')
query_params = '?course={}&course={}'.format(str(our_courses[0].id),
unlinked_course_id)
assert self.invalid_course_ids_raise_404(monkeypatch,
lm_test_data,
query_params)

0 comments on commit ef297f0

Please sign in to comment.