Skip to content

Commit

Permalink
feat!: remove mock toggle endpoint (#2641)
Browse files Browse the repository at this point in the history
The `mock-toggles` REST endpoint was used for testing a feature used by 2U for collecting the configuration of settings in OeX IDAs. The feature was never fully implemented in Credentials and this endpoint is no longer being used, so we are removing it.
  • Loading branch information
justinhynes authored Nov 19, 2024
1 parent 31ade69 commit 5b32c70
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 45 deletions.
3 changes: 1 addition & 2 deletions credentials/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from credentials.apps.plugins.constants import PROJECT_TYPE
from credentials.apps.records.views import ProgramListingView
from credentials.apps.verifiable_credentials.toggles import is_verifiable_credentials_enabled
from credentials.views import FaviconView, MockToggleStateView
from credentials.views import FaviconView


admin.autodiscover()
Expand Down Expand Up @@ -65,7 +65,6 @@
path("records/", include(("credentials.apps.records.urls", "records"), namespace="records")),
re_path(r"^program-listing/", ProgramListingView.as_view(), name="program_listing"),
re_path(r"^favicon\.ico$", FaviconView.as_view(permanent=True)),
path("mock-toggles", MockToggleStateView.as_view()),
]

if is_verifiable_credentials_enabled():
Expand Down
43 changes: 0 additions & 43 deletions credentials/views.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
from django.conf import settings
from django.views.generic.base import RedirectView
from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication
from edx_rest_framework_extensions.permissions import IsStaff
from rest_framework import permissions, views
from rest_framework.authentication import SessionAuthentication
from rest_framework.response import Response


class FaviconView(RedirectView):
Expand All @@ -16,41 +11,3 @@ def get_redirect_url(self, *_args, **_kwargs):
if not settings.FAVICON_URL:
return None
return settings.FAVICON_URL


class MockToggleStateView(views.APIView): # pragma: no cover
"""
A mock endpoint showing that we can require a staff JWT in this IDA,
and allowing us to test integration of multiple IDAs into toggle state
reports (ARCHBOM-1569). This can go away once edx-toggles is ready and
integrated.
"""

authentication_classes = (
JwtAuthentication,
SessionAuthentication,
)
permission_classes = (
permissions.IsAuthenticated,
IsStaff,
)

def get(self, request):
return Response(
{
"waffle_flags": [
{
"name": "mock.flag",
"class": "WaffleFlag",
"module": "mock.core.djangoapps.fake",
"code_owner": "platform-arch",
"computed_status": "off",
}
],
"waffle_switches": [],
"django_settings": [
{"name": "MOCK_DEBUG", "is_active": False},
{"name": "OTHER_MOCK['stuff']", "is_active": True},
],
}
)

0 comments on commit 5b32c70

Please sign in to comment.