Skip to content

Commit 6cf67cb

Browse files
author
Tycho Hob
committed
test: Pick up coverge changes
1 parent ab1329f commit 6cf67cb

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

openedx_authz/tests/test_migrations.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,24 @@ def test_authz_migrate_course_authoring_command(self, mock_migrate):
942942

943943
self.assertEqual(kwargs["delete_after_migration"], True)
944944

945+
@patch("openedx_authz.management.commands.authz_migrate_course_authoring.CourseAccessRole", CourseAccessRole)
946+
@patch("openedx_authz.management.commands.authz_migrate_course_authoring.migrate_legacy_course_roles_to_authz")
947+
def test_authz_migrate_course_authoring_command_mixed_success(self, mock_migrate):
948+
"""
949+
Verify that the authz_migrate_course_authoring command outputs without errors
950+
for mixed success operations.
951+
"""
952+
953+
mock_migrate.return_value = (
954+
[self.course_id],
955+
["course-v1:fail"],
956+
) # Return empty lists for permissions with and without errors
957+
958+
# Run without --delete
959+
call_command("authz_migrate_course_authoring", "--course-id-list", self.course_id)
960+
961+
mock_migrate.assert_called_once()
962+
945963
@patch("openedx_authz.management.commands.authz_rollback_course_authoring.CourseAccessRole", CourseAccessRole)
946964
@patch("openedx_authz.management.commands.authz_rollback_course_authoring.migrate_authz_to_legacy_course_roles")
947965
def test_authz_rollback_course_authoring_command(self, mock_rollback):
@@ -972,6 +990,24 @@ def test_authz_rollback_course_authoring_command(self, mock_rollback):
972990

973991
self.assertEqual(call_kwargs["delete_after_migration"], True)
974992

993+
@patch("openedx_authz.management.commands.authz_rollback_course_authoring.CourseAccessRole", CourseAccessRole)
994+
@patch("openedx_authz.management.commands.authz_rollback_course_authoring.migrate_authz_to_legacy_course_roles")
995+
def test_authz_rollback_course_authoring_command_mixed_success(self, mock_rollback):
996+
"""
997+
Verify that the authz_rollback_course_authoring command does not error in
998+
mixed success operations.
999+
"""
1000+
1001+
mock_rollback.return_value = (
1002+
[self.course_id],
1003+
["course-v1:fail"],
1004+
) # Return empty lists for permissions with and without errors
1005+
1006+
# Run without --delete
1007+
call_command("authz_rollback_course_authoring", "--course-id-list", self.course_id)
1008+
1009+
mock_rollback.assert_called_once()
1010+
9751011
@patch("openedx_authz.management.commands.authz_migrate_course_authoring.CourseAccessRole", CourseAccessRole)
9761012
@patch("openedx_authz.management.commands.authz_migrate_course_authoring.migrate_legacy_course_roles_to_authz")
9771013
def test_authz_migrate_course_authoring_command_delete_confirmation_no(self, mock_migrate):

0 commit comments

Comments
 (0)