diff --git a/cms/djangoapps/contentstore/rest_api/v3/serializers.py b/cms/djangoapps/contentstore/rest_api/v3/serializers.py new file mode 100644 index 000000000000..3c8aa5028aa9 --- /dev/null +++ b/cms/djangoapps/contentstore/rest_api/v3/serializers.py @@ -0,0 +1,19 @@ +""" +Serializers for the v3 contentstore API. +""" + +from cms.djangoapps.contentstore.rest_api.v1.serializers import StudioHomeSerializer + + +class StudioHomeContextSerializer(StudioHomeSerializer): + """ + The Studio home page settings, without the course and library lists. + + The v3 home is built with ``get_home_context(request, True)``, which leaves + those lists empty; they are served by ``/api/authoring/v4/courses/`` and the + library APIs instead. + """ + archived_courses = None + courses = None + in_process_course_actions = None + libraries = None diff --git a/cms/djangoapps/contentstore/rest_api/v3/views/home.py b/cms/djangoapps/contentstore/rest_api/v3/views/home.py index 0b62b08d6b8a..1bdfd67b23b5 100644 --- a/cms/djangoapps/contentstore/rest_api/v3/views/home.py +++ b/cms/djangoapps/contentstore/rest_api/v3/views/home.py @@ -12,9 +12,9 @@ * ADR 0029 – standardized error envelope, opted in via :class:`StandardizedErrorMixin` (v3-scoped — does not change the project-wide DRF ``EXCEPTION_HANDLER`` setting) - * ADR 0036 – field selection via ``?fields=`` (e.g. ``?fields=courses``). - The ``list`` action returns a wide ``StudioHomeSerializer`` payload with - ~25 top-level keys; clients that only need a subset can request it + * ADR 0036 – field selection via ``?fields=`` (e.g. ``?fields=studio_name``). + The ``list`` action returns a wide ``StudioHomeContextSerializer`` payload + with ~20 top-level keys; clients that only need a subset can request it explicitly. The flat-list ``courses`` and ``libraries`` actions are out of scope (single-key dict around a list) and do not honour ``?fields=``. @@ -40,11 +40,8 @@ from rest_framework.request import Request from rest_framework.response import Response -from cms.djangoapps.contentstore.rest_api.v1.serializers import ( - CourseHomeTabSerializer, - LibraryTabSerializer, - StudioHomeSerializer, -) +from cms.djangoapps.contentstore.rest_api.v1.serializers import CourseHomeTabSerializer, LibraryTabSerializer +from cms.djangoapps.contentstore.rest_api.v3.serializers import StudioHomeContextSerializer from cms.djangoapps.contentstore.utils import get_course_context, get_home_context, get_library_context from cms.lib.spectacular import CmsAutoSchema @@ -72,7 +69,7 @@ class HomeViewSet(StandardizedErrorMixin, viewsets.ViewSet): schema = _HomeAutoSchema() authentication_classes = (JwtAuthentication, SessionAuthenticationAllowInactiveUser) permission_classes = (IsAuthenticated,) - serializer_class = StudioHomeSerializer + serializer_class = StudioHomeContextSerializer def get_serializer_class(self): """Return the appropriate serializer class for the current action.""" @@ -80,16 +77,15 @@ def get_serializer_class(self): return CourseHomeTabSerializer if self.action == 'libraries': return LibraryTabSerializer - return StudioHomeSerializer + return StudioHomeContextSerializer def get_serializer(self, *args, **kwargs): """Return a serializer instance using the action-appropriate class.""" return self.get_serializer_class()(*args, **kwargs) @extend_schema( - responses={(200, "application/json"): StudioHomeSerializer}, + responses={(200, "application/json"): StudioHomeContextSerializer}, parameters=[ - OpenApiParameter("org", str, OpenApiParameter.QUERY, description="Filter by course org"), OpenApiParameter( "fields", str, @@ -97,7 +93,7 @@ def get_serializer(self, *args, **kwargs): description=( "ADR 0036 explicit field selection. Comma-separated list " "of top-level keys to include in the response (e.g. " - "``courses,libraries,studio_name``). Omit for the full " + "``studio_name,platform_name``). Omit for the full " "response. Unknown keys are silently skipped." ), ), @@ -105,12 +101,15 @@ def get_serializer(self, *args, **kwargs): ) def list(self, request: Request): """ - Get an object containing all courses and libraries on home page. + Get the Studio home page settings for the requesting user. + + The course and library lists are not included; use + ``/api/authoring/v4/courses/`` for the courses. **Example Request** GET /api/contentstore/v3/home/ - GET /api/contentstore/v3/home/?fields=courses,libraries (ADR 0036) + GET /api/contentstore/v3/home/?fields=studio_name,platform_name (ADR 0036) """ home_context = get_home_context(request, True) home_context.update({ @@ -144,6 +143,8 @@ def list(self, request: Request): 401: OpenApiResponse(description="The requester is not authenticated."), }, ) + # Replaced by /api/authoring/v4/courses/, so it stays out of the public schema. + @extend_schema(exclude=True) @action(detail=False, methods=['get'], url_path='courses', url_name='courses') def courses(self, request: Request): """ @@ -186,6 +187,8 @@ def courses(self, request: Request): 401: OpenApiResponse(description="The requester is not authenticated."), }, ) + # The legacy library list, which is being removed, so it stays out of the public schema. + @extend_schema(exclude=True) @action(detail=False, methods=['get'], url_path='libraries', url_name='libraries') def libraries(self, request: Request): """ diff --git a/cms/djangoapps/contentstore/rest_api/v3/views/tests/test_home.py b/cms/djangoapps/contentstore/rest_api/v3/views/tests/test_home.py index 980d33b81bd3..bde45f8c2f8d 100644 --- a/cms/djangoapps/contentstore/rest_api/v3/views/tests/test_home.py +++ b/cms/djangoapps/contentstore/rest_api/v3/views/tests/test_home.py @@ -5,7 +5,7 @@ patch.object is used for the ViewSet's get_serializer() method because: - get_serializer_class() returns a *different* serializer per action. - - Each serializer (StudioHomeSerializer, CourseHomeTabSerializer, + - Each serializer (StudioHomeContextSerializer, CourseHomeTabSerializer, LibraryTabSerializer) has many required fields that would be painful to satisfy with synthetic data. - Patching get_serializer() lets us focus on routing + service-call @@ -14,10 +14,13 @@ """ from unittest.mock import patch +from django.test import SimpleTestCase from django.urls import reverse from rest_framework import status from rest_framework.test import APITestCase +from cms.djangoapps.contentstore.rest_api.v2.views.tests.helpers import generate_cms_schema +from cms.djangoapps.contentstore.rest_api.v3.serializers import StudioHomeContextSerializer from cms.djangoapps.contentstore.rest_api.v3.views.home import HomeViewSet from common.djangoapps.student.tests.factories import UserFactory @@ -124,7 +127,7 @@ def test_libraries_calls_get_library_context(self, mock_libs, mock_get_ser): class TestHomeViewSetFieldSelection(APITestCase): """ ADR 0036 — verify ``?fields=`` filters top-level keys on the ``list`` - action's wide ``StudioHomeSerializer`` response. ``courses`` and + action's wide ``StudioHomeContextSerializer`` response. ``courses`` and ``libraries`` actions are out of scope (single-key dicts). """ @@ -143,31 +146,48 @@ def test_default_response_keeps_all_keys(self, mock_home, mock_org, mock_get_ser mock_org.is_autocreate_enabled.return_value = True mock_get_ser.return_value.data = { 'studio_name': 'Studio', 'platform_name': 'edX', - 'courses': [], 'libraries': [], 'archived_courses': [], + 'course_creator_status': 'granted', 'user_is_active': True, } response = self.client.get(self.url) assert response.status_code == status.HTTP_200_OK assert set(response.data.keys()) == { - 'studio_name', 'platform_name', 'courses', 'libraries', 'archived_courses', + 'studio_name', 'platform_name', 'course_creator_status', 'user_is_active', } @patch.object(HomeViewSet, 'get_serializer') @patch(MOCK_ORG_API) @patch(MOCK_GET_HOME_CONTEXT) def test_fields_csv_restricts_top_level_keys(self, mock_home, mock_org, mock_get_ser): # noqa: ARG002 - """``?fields=courses,libraries`` returns exactly those keys.""" + """``?fields=course_creator_status,user_is_active`` returns exactly those keys.""" mock_home.return_value = {'can_create_organizations': True} mock_org.is_autocreate_enabled.return_value = True mock_get_ser.return_value.data = { 'studio_name': 'Studio', 'platform_name': 'edX', - 'courses': [], 'libraries': [], 'archived_courses': [], + 'course_creator_status': 'granted', 'user_is_active': True, } - response = self.client.get(self.url, {'fields': 'courses,libraries'}) + response = self.client.get(self.url, {'fields': 'course_creator_status,user_is_active'}) assert response.status_code == status.HTTP_200_OK - assert set(response.data.keys()) == {'courses', 'libraries'} + assert set(response.data.keys()) == {'course_creator_status', 'user_is_active'} assert 'studio_name' not in response.data assert 'platform_name' not in response.data + + +class TestHomeViewSetSchema(SimpleTestCase): + """Only the ``list`` action is published, and it describes no course or library lists.""" + + def test_only_the_home_settings_are_published(self): + paths = generate_cms_schema()['paths'] + for prefix in ('/api/contentstore/v3/home/', '/api/authoring/v3/home/'): + assert prefix in paths + assert f'{prefix}courses/' not in paths + assert f'{prefix}libraries/' not in paths + + def test_the_home_settings_leave_out_the_course_and_library_lists(self): + fields = StudioHomeContextSerializer().fields + for name in ('courses', 'archived_courses', 'in_process_course_actions', 'libraries'): + assert name not in fields + assert 'course_creator_status' in fields diff --git a/cms/djangoapps/contentstore/views/course.py b/cms/djangoapps/contentstore/views/course.py index bfac4aa46fc1..ca3df7edb7cf 100644 --- a/cms/djangoapps/contentstore/views/course.py +++ b/cms/djangoapps/contentstore/views/course.py @@ -49,7 +49,7 @@ from cms.djangoapps.contentstore.api.views.utils import get_bool_param, get_datetime_param from cms.djangoapps.contentstore.xblock_storage_handlers.view_handlers import create_xblock_info from cms.djangoapps.course_creators.models import CourseCreator -from cms.djangoapps.course_creators.views import add_user_with_status_unrequested, get_course_creator_status +from cms.djangoapps.course_creators.views import get_course_creator_status from cms.djangoapps.models.settings.course_grading import CourseGradingModel from cms.djangoapps.models.settings.course_metadata import CourseMetadata from cms.djangoapps.models.settings.encoder import CourseSettingsEncoder @@ -2053,8 +2053,8 @@ def _get_course_creator_status(user): Helper method for returning the course creator status for a particular user, taking into account the values of DISABLE_COURSE_CREATION and ENABLE_CREATOR_GROUP. - If the user passed in has not previously visited the index page, it will be - added with status 'unrequested' if the course creator group is in use. + A user with no entry in the course creator table is reported as 'unrequested'; + the entry is created when they request access. """ if user.is_staff: @@ -2062,12 +2062,7 @@ def _get_course_creator_status(user): elif getattr(settings, 'DISABLE_COURSE_CREATION', False): course_creator_status = 'disallowed_for_this_site' elif getattr(settings, 'ENABLE_CREATOR_GROUP', False): - course_creator_status = get_course_creator_status(user) - if course_creator_status is None: - # User not grandfathered in as an existing user, has not previously visited the dashboard page. - # Add the user to the course creator admin table with status 'unrequested'. - add_user_with_status_unrequested(user) - course_creator_status = get_course_creator_status(user) + course_creator_status = get_course_creator_status(user) or CourseCreator.UNREQUESTED else: course_creator_status = 'granted' diff --git a/cms/djangoapps/course_creators/admin.py b/cms/djangoapps/course_creators/admin.py index 727c70bff687..1ae6c388c050 100644 --- a/cms/djangoapps/course_creators/admin.py +++ b/cms/djangoapps/course_creators/admin.py @@ -81,6 +81,13 @@ class CourseCreatorAdmin(admin.ModelAdmin): 'fields': ['username', 'state', 'state_changed', 'note', 'all_organizations', 'organizations'] }), ) + # The user is chosen by id on the add form, and read-only once added. + add_fieldsets = ( + (None, { + 'fields': ['user', 'state', 'note', 'all_organizations', 'organizations'] + }), + ) + raw_id_fields = ('user',) # Fields that filtering support list_filter = ['state', 'state_changed'] # Fields that search supports. @@ -99,8 +106,13 @@ def username(self, inst): username.admin_order_field = 'user__username' + def get_fieldsets(self, request, obj=None): + if obj is None: + return self.add_fieldsets + return super().get_fieldsets(request, obj) + def has_add_permission(self, request): - return False + return request.user.is_staff def has_delete_permission(self, request, obj=None): return False diff --git a/cms/djangoapps/course_creators/tests/test_admin.py b/cms/djangoapps/course_creators/tests/test_admin.py index 02c1633ad451..2030aeacbf18 100644 --- a/cms/djangoapps/course_creators/tests/test_admin.py +++ b/cms/djangoapps/course_creators/tests/test_admin.py @@ -11,6 +11,7 @@ from django.http import HttpRequest from django.test import TestCase from django.test.utils import override_settings +from django.urls import reverse from cms.djangoapps.course_creators.admin import CourseCreatorAdmin from cms.djangoapps.course_creators.models import CourseCreator @@ -149,9 +150,36 @@ def _change_state(self, state): def test_add_permission(self): """ - Tests that staff cannot add entries + Tests that only staff can add entries """ - self.assertFalse(self.creator_admin.has_add_permission(self.request)) # noqa: PT009 + assert self.creator_admin.has_add_permission(self.request) + + self.request.user = self.user + assert not self.creator_admin.has_add_permission(self.request) + + @override_settings(ENABLE_CREATOR_GROUP=True) + def test_staff_can_grant_a_user_who_has_not_requested_access(self): + new_user = UserFactory.create() + superuser = UserFactory.create(is_staff=True, is_superuser=True, password='foo') + self.client.login(username=superuser.username, password='foo') + + response = self.client.post(reverse('admin:course_creators_coursecreator_add'), { + 'user': new_user.id, + 'state': CourseCreator.GRANTED, + 'note': '', + 'all_organizations': 'on', + }) + + assert response.status_code == 302 + assert CourseCreator.objects.get(user=new_user).state == CourseCreator.GRANTED + assert auth.user_has_role(new_user, CourseCreatorRole()) + + def test_the_user_is_read_only_once_added(self): + add_fields = self.creator_admin.get_fieldsets(self.request)[0][1]['fields'] + change_fields = self.creator_admin.get_fieldsets(self.request, self.table_entry)[0][1]['fields'] + assert 'user' in add_fields + assert 'user' not in change_fields + assert 'username' in self.creator_admin.get_readonly_fields(self.request, self.table_entry) def test_delete_permission(self): """ diff --git a/cms/djangoapps/course_creators/tests/test_views.py b/cms/djangoapps/course_creators/tests/test_views.py index d4554263a8bd..898c65097e52 100644 --- a/cms/djangoapps/course_creators/tests/test_views.py +++ b/cms/djangoapps/course_creators/tests/test_views.py @@ -2,15 +2,17 @@ Tests course_creators.views.py. """ +from unittest import mock from django.core.exceptions import PermissionDenied from django.test import TestCase from django.test.utils import override_settings from django.urls import reverse +from cms.djangoapps.contentstore.views.course import _get_course_creator_status +from cms.djangoapps.course_creators.models import CourseCreator from cms.djangoapps.course_creators.views import ( add_user_with_status_granted, - add_user_with_status_unrequested, get_course_creator_status, update_course_creator_group, update_org_content_creator_role, @@ -55,14 +57,6 @@ def test_staff_permission_required(self): def test_table_initially_empty(self): self.assertIsNone(get_course_creator_status(self.user)) # noqa: PT009 - def test_add_unrequested(self): - add_user_with_status_unrequested(self.user) - self.assertEqual('unrequested', get_course_creator_status(self.user)) # noqa: PT009 - - # Calling add again will be a no-op (even if state is different). - add_user_with_status_granted(self.admin, self.user) - self.assertEqual('unrequested', get_course_creator_status(self.user)) # noqa: PT009 - @override_settings(ENABLE_CREATOR_GROUP=True) def test_add_granted(self): # Calling add_user_with_status_granted impacts is_user_in_course_group_role. @@ -71,10 +65,6 @@ def test_add_granted(self): add_user_with_status_granted(self.admin, self.user) self.assertEqual('granted', get_course_creator_status(self.user)) # noqa: PT009 - # Calling add again will be a no-op (even if state is different). - add_user_with_status_unrequested(self.user) - self.assertEqual('granted', get_course_creator_status(self.user)) # noqa: PT009 - self.assertTrue(auth.user_has_role(self.user, CourseCreatorRole())) # noqa: PT009 @override_settings(ENABLE_CREATOR_GROUP=True) @@ -93,8 +83,9 @@ def test_update_org_content_creator_role(self): update_org_content_creator_role(self.admin, self.user, []) self.assertFalse(auth.user_has_role(self.user, OrgContentCreatorRole(self.org))) # noqa: PT009 + @override_settings(ENABLE_CREATOR_GROUP=True) def test_user_requested_access(self): - add_user_with_status_unrequested(self.user) + CourseCreator.objects.create(user=self.user, state=CourseCreator.UNREQUESTED) self.assertEqual('unrequested', get_course_creator_status(self.user)) # noqa: PT009 self.client.login(username=self.user.username, password='foo') @@ -105,6 +96,41 @@ def test_user_requested_access(self): self.client.post(reverse('request_course_creator')) self.assertEqual('pending', get_course_creator_status(self.user)) # noqa: PT009 + @override_settings(ENABLE_CREATOR_GROUP=True) + def test_reading_the_status_of_a_user_without_an_entry_adds_none(self): + assert _get_course_creator_status(self.user) == 'unrequested' + assert get_course_creator_status(self.user) is None + + @override_settings(ENABLE_CREATOR_GROUP=True) + @mock.patch('cms.djangoapps.course_creators.models.send_admin_notification') + def test_user_requested_access_without_an_entry(self, admin_notification): + self.client.login(username=self.user.username, password='foo') + self.client.post(reverse('request_course_creator')) + assert get_course_creator_status(self.user) == 'pending' + admin_notification.send.assert_called_once() + + @override_settings(ENABLE_CREATOR_GROUP=True) + @mock.patch('cms.djangoapps.course_creators.models.send_admin_notification') + def test_staff_request_is_not_recorded(self, admin_notification): + user_requested_access(self.admin) + assert get_course_creator_status(self.admin) is None + admin_notification.send.assert_not_called() + + @override_settings(ENABLE_CREATOR_GROUP=False) + @mock.patch('cms.djangoapps.course_creators.models.send_admin_notification') + def test_request_is_not_recorded_without_the_creator_group(self, admin_notification): + user_requested_access(self.user) + assert get_course_creator_status(self.user) is None + admin_notification.send.assert_not_called() + + @override_settings(ENABLE_CREATOR_GROUP=True, DISABLE_COURSE_CREATION=True) + @mock.patch('cms.djangoapps.course_creators.models.send_admin_notification') + def test_request_is_not_recorded_when_course_creation_is_disabled(self, admin_notification): + user_requested_access(self.user) + assert get_course_creator_status(self.user) is None + admin_notification.send.assert_not_called() + + @override_settings(ENABLE_CREATOR_GROUP=True) def test_user_requested_already_granted(self): add_user_with_status_granted(self.admin, self.user) self.assertEqual('granted', get_course_creator_status(self.user)) # noqa: PT009 @@ -113,11 +139,6 @@ def test_user_requested_already_granted(self): user_requested_access(self.user) self.assertEqual('granted', get_course_creator_status(self.user)) # noqa: PT009 - def test_add_user_unrequested_staff(self): - # Users marked as is_staff will not be added to the course creator table. - add_user_with_status_unrequested(self.admin) - self.assertIsNone(get_course_creator_status(self.admin)) # noqa: PT009 - def test_add_user_granted_staff(self): # Users marked as is_staff will not be added to the course creator table. add_user_with_status_granted(self.admin, self.admin) diff --git a/cms/djangoapps/course_creators/views.py b/cms/djangoapps/course_creators/views.py index 199bae1c41de..a2c93327e7c4 100644 --- a/cms/djangoapps/course_creators/views.py +++ b/cms/djangoapps/course_creators/views.py @@ -3,24 +3,13 @@ """ +from django.conf import settings + from cms.djangoapps.course_creators.models import CourseCreator from common.djangoapps.student import auth from common.djangoapps.student.roles import CourseCreatorRole, OrgContentCreatorRole -def add_user_with_status_unrequested(user): - """ - Adds a user to the course creator table with status 'unrequested'. - - If the user is already in the table, this method is a no-op - (state will not be changed). - - If the user is marked as is_staff, this method is a no-op (user - will not be added to table). - """ - _add_user(user, CourseCreator.UNREQUESTED) - - def add_user_with_status_granted(caller, user): """ Adds a user to the course creator table with status 'granted'. @@ -85,8 +74,19 @@ def user_requested_access(user): This changes the user state to CourseCreator.PENDING, unless the user state is already CourseCreator.GRANTED, in which case this method is a no-op. + A user not yet in the table is added first. Nothing is recorded where the + table is not consulted: for staff, and on sites where course creation is + disabled or not restricted to the creator group. """ - user = CourseCreator.objects.get(user=user) + if ( + user.is_staff + or getattr(settings, 'DISABLE_COURSE_CREATION', False) + or not getattr(settings, 'ENABLE_CREATOR_GROUP', False) + ): + return + # Created as 'unrequested' and then saved as 'pending', so that the change + # of state notifies the admins. + user, _ = CourseCreator.objects.get_or_create(user=user) if user.state != CourseCreator.GRANTED: user.state = CourseCreator.PENDING user.save() diff --git a/cms/envs/common.py b/cms/envs/common.py index ed0d2b0cbf3c..66a1568f2fb6 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -1331,9 +1331,9 @@ def _should_send_xblock_events(settings): 'SERVE_INCLUDE_SCHEMA': False, # Restrict the schema to the Authoring API's endpoints (cms/lib/spectacular.py). 'PREPROCESSING_HOOKS': ['cms.lib.spectacular.cms_api_filter'], - # Mark superseded and migrated legacy addresses deprecated, and BFF surfaces - # x-internal. The enum hook is drf-spectacular's default, restated because - # setting this key replaces the default list. + # Mark superseded and migrated legacy addresses deprecated. The enum hook is + # drf-spectacular's default, restated because setting this key replaces the + # default list. 'POSTPROCESSING_HOOKS': [ 'drf_spectacular.hooks.postprocess_schema_enums', 'cms.lib.spectacular.cms_mark_superseded_paths', diff --git a/cms/lib/spectacular.py b/cms/lib/spectacular.py index 662cf80c65f0..b946da20d351 100644 --- a/cms/lib/spectacular.py +++ b/cms/lib/spectacular.py @@ -32,13 +32,6 @@ "/api/contentstore/v3/home/", ) -# BFF surfaces, marked x-internal so clients can tell them from a stable -# resource contract. Both the legacy and conforming mounts. -INTERNAL_BFF_PATH_PREFIXES = ( - "/api/contentstore/v3/home/", - "/api/authoring/v3/home/", -) - def cms_api_filter(endpoints): """ @@ -93,18 +86,12 @@ def get_operation_id(self): def cms_mark_migrated_paths(result, generator, request, public): # pylint: disable=unused-argument """ Post-processing hook: mark the legacy addresses of - migrated APIs ``deprecated: true`` and BFF surfaces ``x-internal``. + migrated APIs ``deprecated: true``. """ for path, path_item in result.get("paths", {}).items(): - legacy = path.startswith(LEGACY_MIGRATED_PATH_PREFIXES) - internal = path.startswith(INTERNAL_BFF_PATH_PREFIXES) - if not (legacy or internal): + if not path.startswith(LEGACY_MIGRATED_PATH_PREFIXES): continue for operation in path_item.values(): - if not isinstance(operation, dict): - continue - if legacy: + if isinstance(operation, dict): operation["deprecated"] = True - if internal: - operation["x-internal"] = True return result diff --git a/cms/lib/tests/test_spectacular.py b/cms/lib/tests/test_spectacular.py index 193f3c98c448..ca5ef3ad222a 100644 --- a/cms/lib/tests/test_spectacular.py +++ b/cms/lib/tests/test_spectacular.py @@ -117,18 +117,16 @@ def test_legacy_paths_deprecated_conforming_paths_not(self): assert "deprecated" not in paths["/api/authoring/v1/xblocks/{usage_key_string}/"]["get"] assert "deprecated" not in paths["/api/authoring/v3/courses/{course_key}/details/"]["get"] - def test_bff_surfaces_internal_on_both_mounts(self): + def test_home_is_public_on_both_mounts(self): result = cms_mark_migrated_paths(_schema( "/api/contentstore/v3/home/", "/api/authoring/v3/home/", - "/api/authoring/v4/courses/", ), None, None, False) paths = result["paths"] - assert paths["/api/contentstore/v3/home/"]["get"]["x-internal"] is True assert paths["/api/contentstore/v3/home/"]["get"]["deprecated"] is True - assert paths["/api/authoring/v3/home/"]["get"]["x-internal"] is True assert "deprecated" not in paths["/api/authoring/v3/home/"]["get"] - assert "x-internal" not in paths["/api/authoring/v4/courses/"]["get"] + assert "x-internal" not in paths["/api/contentstore/v3/home/"]["get"] + assert "x-internal" not in paths["/api/authoring/v3/home/"]["get"] def test_paths_are_left_as_full_urls(self): """Paths are not trimmed, so every key resolves against a service-root server."""