diff --git a/platform_plugin_aspects/tests/test_views.py b/platform_plugin_aspects/tests/test_views.py index 4d5a61e..a3fad12 100644 --- a/platform_plugin_aspects/tests/test_views.py +++ b/platform_plugin_aspects/tests/test_views.py @@ -11,7 +11,7 @@ from opaque_keys.edx.keys import CourseKey from rest_framework.test import APIClient -from ..views import Course, IsCourseStaffInstructor +from ..views import DEFAULT_FILTERS_FORMAT, IsCourseStaffInstructor COURSE_ID = "course-v1:org+course+run" User = get_user_model() @@ -116,13 +116,7 @@ def test_guest_token_with_course_overview( mock_model_get.assert_called_once() mock_generate_guest_token.assert_called_once_with( user=self.user, - course=Course( - course_id=CourseKey.from_string(COURSE_ID), display_name="Course Title" - ), + course=CourseKey.from_string(COURSE_ID), dashboards=settings.ASPECTS_INSTRUCTOR_DASHBOARDS, - filters=[ - "org = 'org'", - "course_name = 'Course Title'", - "course_run = 'run'", - ], + filters=DEFAULT_FILTERS_FORMAT, ) diff --git a/platform_plugin_aspects/utils.py b/platform_plugin_aspects/utils.py index 9afa2cf..2537495 100644 --- a/platform_plugin_aspects/utils.py +++ b/platform_plugin_aspects/utils.py @@ -112,7 +112,9 @@ def generate_guest_token(user, course, dashboards, filters) -> str: superset_username = superset_config.get("username") superset_password = superset_config.get("password") - formatted_filters = [filter.format(course_id=course, user=user) for filter in filters] + formatted_filters = [ + filter.format(course_id=course, user=user) for filter in filters + ] resources = []