Skip to content

Commit

Permalink
fix: course mode list concatenation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
varshamenon4 committed Nov 25, 2024
1 parent dcf45e2 commit 117d9d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion learning_assistant/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ def post(self, request, course_run_id):
if (
# Here we include CREDIT_MODE and NO_ID_PROFESSIONAL_MODE, as CourseMode.VERIFIED_MODES on its own
# doesn't match what we count as "verified modes" in the frontend component.
enrollment_mode in CourseMode.VERIFIED_MODES + CourseMode.CREDIT_MODE + CourseMode.NO_ID_PROFESSIONAL_MODE
enrollment_mode in CourseMode.VERIFIED_MODES + CourseMode.CREDIT_MODES
+ [CourseMode.NO_ID_PROFESSIONAL_MODE]
or user_role_is_staff(user_role)
):
return self._get_next_message(request, courserun_key, course_run_id)
Expand Down
12 changes: 6 additions & 6 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ def test_audit_trial_expired(self, mock_mode, mock_enrollment,
mock_waffle.return_value = True
mock_role.return_value = 'student'
mock_mode.VERIFIED_MODES = ['verified']
mock_mode.CREDIT_MODE = ['credit']
mock_mode.NO_ID_PROFESSIONAL_MODE = ['no-id']
mock_mode.CREDIT_MODES = ['credit']
mock_mode.NO_ID_PROFESSIONAL_MODE = 'no-id'
mock_mode.UPSELL_TO_VERIFIED_MODES = ['audit']
mock_mode.objects.get.return_value = MagicMock()
mock_mode.expiration_datetime.return_value = datetime.now() - timedelta(days=1)
Expand All @@ -165,8 +165,8 @@ def test_invalid_enrollment_mode(self, mock_mode, mock_enrollment, mock_role, mo
mock_waffle.return_value = True
mock_role.return_value = 'student'
mock_mode.VERIFIED_MODES = ['verified']
mock_mode.CREDIT_MODE = ['credit']
mock_mode.NO_ID_PROFESSIONAL_MODE = ['no-id']
mock_mode.CREDIT_MODES = ['credit']
mock_mode.NO_ID_PROFESSIONAL_MODE = 'no-id'
mock_mode.UPSELL_TO_VERIFIED_MODES = ['audit']
mock_mode.objects.get.return_value = MagicMock()
mock_mode.expiration_datetime.return_value = datetime.now() - timedelta(days=1)
Expand Down Expand Up @@ -206,8 +206,8 @@ def test_chat_response_default(
mock_waffle.return_value = True
mock_role.return_value = 'student'
mock_mode.VERIFIED_MODES = ['verified']
mock_mode.CREDIT_MODE = ['credit']
mock_mode.NO_ID_PROFESSIONAL_MODE = ['no-id']
mock_mode.CREDIT_MODES = ['credit']
mock_mode.NO_ID_PROFESSIONAL_MODE = 'no-id'
mock_mode.UPSELL_TO_VERIFIED_MODES = ['audit']
mock_enrollment.return_value = MagicMock(mode=enrollment_mode)
mock_chat_response.return_value = (200, {'role': 'assistant', 'content': 'Something else'})
Expand Down

0 comments on commit 117d9d4

Please sign in to comment.