From 57e789001ba91e0ae7595bc2348faf09fbbe623a Mon Sep 17 00:00:00 2001 From: Cristhian Garcia Date: Tue, 30 Apr 2024 13:15:56 -0500 Subject: [PATCH] test: update tests with filters --- platform_plugin_aspects/tests/test_views.py | 12 +++--------- platform_plugin_aspects/utils.py | 4 +++- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/platform_plugin_aspects/tests/test_views.py b/platform_plugin_aspects/tests/test_views.py index 4d5a61e..fd3eade 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 Course, IsCourseStaffInstructor, DEFAULT_FILTERS_FORMAT 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 bcf6477..bc97693 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 = []