feat: enable user tours by default, dropping rollout toggle

AA-1177
This commit is contained in:
Michael Terry
2022-02-17 14:14:17 -05:00
parent 203e2e9c04
commit 203863376b
3 changed files with 0 additions and 33 deletions

View File

@@ -1,16 +0,0 @@
"""
Toggles for the User Tours Experience.
"""
from edx_toggles.toggles import WaffleFlag
# .. toggle_name: user_tours.tours_enabled
# .. toggle_implementation: WaffleFlag
# .. toggle_default: False
# .. toggle_description: This flag enables the use of user tours in the LMS.
# .. toggle_warnings: None
# .. toggle_use_cases: temporary
# .. toggle_creation_date: 2021-12-01
# .. toggle_target_removal_date: 2022-02-14
# .. toggle_tickets: https://openedx.atlassian.net/browse/AA-1026
USER_TOURS_ENABLED = WaffleFlag('user_tours.tours_enabled', module_name=__name__, log_prefix='user_tours')

View File

@@ -5,20 +5,17 @@ from django.contrib.auth import get_user_model
from django.db.models.signals import post_save
from django.test import TestCase
from django.urls import reverse
from edx_toggles.toggles.testutils import override_waffle_flag
from rest_framework import status
from common.djangoapps.student.tests.factories import UserFactory
from lms.djangoapps.user_tours.handlers import init_user_tour
from lms.djangoapps.user_tours.models import UserTour
from lms.djangoapps.user_tours.toggles import USER_TOURS_ENABLED
from openedx.core.djangoapps.oauth_dispatch.jwt import create_jwt_for_user
User = get_user_model()
@ddt.ddt
@override_waffle_flag(USER_TOURS_ENABLED, active=True)
class TestUserTourView(TestCase):
""" Tests for the v1 User Tour views. """
def setUp(self):
@@ -48,13 +45,6 @@ class TestUserTourView(TestCase):
elif method == 'PATCH':
return self.client.patch(url, data, content_type='application/json', **headers)
@ddt.data('GET', 'PATCH')
@override_waffle_flag(USER_TOURS_ENABLED, active=False)
def test_waffle_flag_off(self, method):
""" Test all endpoints if the waffle flag is turned off. """
response = self.send_request(self.staff_user, self.user, method)
assert response.status_code == status.HTTP_403_FORBIDDEN
@ddt.data('GET', 'PATCH')
def test_unauthorized_user(self, method):
""" Test all endpoints if request does not have jwt auth. """

View File

@@ -7,7 +7,6 @@ from rest_framework.response import Response
from rest_framework import status
from lms.djangoapps.user_tours.models import UserTour
from lms.djangoapps.user_tours.toggles import USER_TOURS_ENABLED
from lms.djangoapps.user_tours.v1.serializers import UserTourSerializer
@@ -40,9 +39,6 @@ class UserTourView(RetrieveUpdateAPIView):
403 if waffle flag is not enabled
404 if the UserTour does not exist (shouldn't happen, but safety first)
"""
if not USER_TOURS_ENABLED.is_enabled():
return Response(status=status.HTTP_403_FORBIDDEN)
if request.user.username != username and not request.user.is_staff:
return Response(status=status.HTTP_400_BAD_REQUEST)
@@ -67,9 +63,6 @@ class UserTourView(RetrieveUpdateAPIView):
401 if unauthorized request
403 if waffle flag is not enabled
"""
if not USER_TOURS_ENABLED.is_enabled():
return Response(status=status.HTTP_403_FORBIDDEN)
if request.user.username != username:
return Response(status=status.HTTP_400_BAD_REQUEST)