refactor(test): use @skip_unless_lms uniformly
This commit is contained in:
committed by
Ned Batchelder
parent
71e2aa7018
commit
12765a7a59
@@ -2,27 +2,24 @@
|
||||
Tests for the Third Party Auth permissions
|
||||
"""
|
||||
|
||||
|
||||
import unittest
|
||||
|
||||
import ddt
|
||||
from django.conf import settings
|
||||
from django.test import RequestFactory, TestCase
|
||||
from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication
|
||||
from edx_rest_framework_extensions.auth.jwt.tests.utils import generate_jwt
|
||||
from rest_framework.authentication import SessionAuthentication
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
from common.djangoapps.third_party_auth.api.permissions import TPA_PERMISSIONS
|
||||
from openedx.core.djangolib.testing.utils import skip_unless_lms
|
||||
|
||||
IDP_SLUG_TESTSHIB = 'testshib'
|
||||
PROVIDER_ID_TESTSHIB = 'saml-' + IDP_SLUG_TESTSHIB
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
|
||||
@skip_unless_lms
|
||||
class ThirdPartyAuthPermissionTest(TestCase):
|
||||
""" Tests for third party auth TPA_PERMISSIONS """
|
||||
|
||||
|
||||
@@ -2,13 +2,10 @@
|
||||
Tests for the Third Party Auth REST API
|
||||
"""
|
||||
|
||||
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
import ddt
|
||||
import six
|
||||
from django.conf import settings
|
||||
from django.http import QueryDict
|
||||
from django.test.utils import override_settings
|
||||
from django.urls import reverse
|
||||
@@ -23,6 +20,7 @@ from common.djangoapps.third_party_auth.api.permissions import (
|
||||
JwtRestrictedApplication
|
||||
)
|
||||
from common.djangoapps.third_party_auth.tests.testutil import ThirdPartyAuthTestMixin
|
||||
from openedx.core.djangolib.testing.utils import skip_unless_lms
|
||||
|
||||
VALID_API_KEY = "i am a key"
|
||||
IDP_SLUG_TESTSHIB = 'testshib'
|
||||
@@ -191,7 +189,7 @@ class UserViewsMixin:
|
||||
|
||||
@override_settings(EDX_API_KEY=VALID_API_KEY)
|
||||
@ddt.ddt
|
||||
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
|
||||
@skip_unless_lms
|
||||
class UserViewAPITests(UserViewsMixin, TpaAPITestCase):
|
||||
"""
|
||||
Test the Third Party Auth User REST API
|
||||
@@ -209,7 +207,7 @@ class UserViewAPITests(UserViewsMixin, TpaAPITestCase):
|
||||
|
||||
@override_settings(EDX_API_KEY=VALID_API_KEY)
|
||||
@ddt.ddt
|
||||
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
|
||||
@skip_unless_lms
|
||||
class UserViewV2APITests(UserViewsMixin, TpaAPITestCase):
|
||||
"""
|
||||
Test the Third Party Auth User REST API
|
||||
@@ -227,7 +225,7 @@ class UserViewV2APITests(UserViewsMixin, TpaAPITestCase):
|
||||
|
||||
@override_settings(EDX_API_KEY=VALID_API_KEY)
|
||||
@ddt.ddt
|
||||
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
|
||||
@skip_unless_lms
|
||||
class UserMappingViewAPITests(TpaAPITestCase):
|
||||
"""
|
||||
Test the Third Party Auth User Mapping REST API
|
||||
@@ -361,7 +359,7 @@ class UserMappingViewAPITests(TpaAPITestCase):
|
||||
self.assertCountEqual(response.data['results'], expect_result)
|
||||
|
||||
|
||||
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
|
||||
@skip_unless_lms
|
||||
class TestThirdPartyAuthUserStatusView(ThirdPartyAuthTestMixin, APITestCase):
|
||||
"""
|
||||
Tests ThirdPartyAuthStatusView.
|
||||
|
||||
Reference in New Issue
Block a user