Skip to content

Commit

Permalink
test: update tests with filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Apr 30, 2024
1 parent 9a3e3ea commit 78822b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
12 changes: 3 additions & 9 deletions platform_plugin_aspects/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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,
)
4 changes: 3 additions & 1 deletion platform_plugin_aspects/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []

Expand Down

0 comments on commit 78822b4

Please sign in to comment.