2525from openedx_authz .models .scopes import get_content_library_model , get_course_overview_model
2626from openedx_authz .rest_api .data import RoleOperationError , RoleOperationStatus
2727from openedx_authz .rest_api .v1 .permissions import AnyScopePermission , DynamicScopePermission
28- from openedx_authz .rest_api .v1 .views import UserValidationAPIView
28+ from openedx_authz .rest_api .v1 .views import ScopesAPIView , UserValidationAPIView
2929from openedx_authz .tests .api .test_roles import BaseRolesTestCase
3030from openedx_authz .tests .stubs .models import LearningPackage
3131
@@ -966,7 +966,7 @@ def setUp(self):
966966
967967 # Patch _build_queryset so tests don't need real DB querysets.
968968 self .build_qs_patcher = patch .object (
969- views . ScopesAPIView ,
969+ ScopesAPIView ,
970970 "_build_queryset" ,
971971 return_value = self .fake_scopes ,
972972 )
@@ -1029,9 +1029,9 @@ def test_type_param_calls_only_expected_queryset(self, scope_type, called_method
10291029 """When type=course only courses are fetched; when type=library only libraries."""
10301030 self .build_qs_patcher .stop ()
10311031 with (
1032- patch .object (views . ScopesAPIView , called_method , return_value = []) as mock_called ,
1033- patch .object (views . ScopesAPIView , skipped_method ) as mock_skipped ,
1034- patch .object (views . ScopesAPIView , "_build_queryset" , return_value = []),
1032+ patch .object (ScopesAPIView , called_method , return_value = []) as mock_called ,
1033+ patch .object (ScopesAPIView , skipped_method ) as mock_skipped ,
1034+ patch .object (ScopesAPIView , "_build_queryset" , return_value = []),
10351035 ):
10361036 response = self .client .get (self .url , {"scope_type" : scope_type })
10371037 self .build_qs_patcher .start ()
@@ -1050,9 +1050,9 @@ def test_type_param_absent_returns_both(self):
10501050 """When type is not specified, both courses and libraries are returned."""
10511051 self .build_qs_patcher .stop ()
10521052 with (
1053- patch .object (views . ScopesAPIView , "_get_courses_queryset" , return_value = []) as mock_courses ,
1054- patch .object (views . ScopesAPIView , "_get_libraries_queryset" , return_value = []) as mock_libraries ,
1055- patch .object (views . ScopesAPIView , "_build_queryset" , return_value = []),
1053+ patch .object (ScopesAPIView , "_get_courses_queryset" , return_value = []) as mock_courses ,
1054+ patch .object (ScopesAPIView , "_get_libraries_queryset" , return_value = []) as mock_libraries ,
1055+ patch .object (ScopesAPIView , "_build_queryset" , return_value = []),
10561056 ):
10571057 response = self .client .get (self .url )
10581058 self .build_qs_patcher .start ()
@@ -1102,7 +1102,7 @@ def test_pagination(self, query_params: dict, expected_page_count: int, has_next
11021102 {"scope_id" : self .COURSE_ORG2 , "display_name_col" : "Course 2" , "org_name" : "Org2" , "scope_type" : "course" },
11031103 ]
11041104 self .build_qs_patcher .stop ()
1105- with patch .object (views . ScopesAPIView , "_build_queryset" , return_value = mixed ):
1105+ with patch .object (ScopesAPIView , "_build_queryset" , return_value = mixed ):
11061106 response = self .client .get (self .url , query_params )
11071107 self .build_qs_patcher .start ()
11081108
0 commit comments