Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
annagav committed Jul 29, 2024
1 parent 18dd89c commit 844ed49
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion openedx/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,8 @@ def enroll_in_edx_course_runs(
username=username,
force_enrollment=force_enrollment,
)
if not enrollment.is_active:
print(enrollment)
if not enrollment["is_active"]:
enrollment = edx_client.enrollments.create_student_enrollment(
course_run.courseware_id,
mode=mode,
Expand Down
4 changes: 2 additions & 2 deletions openedx/api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ def test_enroll_in_edx_course_runs(settings, mocker, user):
"""Tests that enroll_in_edx_course_runs uses the EdxApi client to enroll in course runs"""
settings.OPENEDX_SERVICE_WORKER_API_TOKEN = "mock_api_token" # noqa: S105
mock_client = mocker.MagicMock()
enroll_return_values = ["result1", "result2"]
enroll_return_values = [{"is_active": True}, {"is_active": False}, {"is_active": True}]
mock_client.enrollments.create_student_enrollment = mocker.Mock(
side_effect=enroll_return_values
)
Expand All @@ -467,7 +467,7 @@ def test_enroll_in_edx_course_runs(settings, mocker, user):
username=user.username,
force_enrollment=True,
)
assert enroll_results == enroll_return_values
assert enroll_results == [{"is_active": True}, {"is_active": True}]


def test_enroll_api_fail(mocker, user):
Expand Down

0 comments on commit 844ed49

Please sign in to comment.