Skip to content

Commit e590493

Browse files
committed
Move tests outside of the oauth2_provider package
1 parent 3fdc7e6 commit e590493

27 files changed

+89
-96
lines changed

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
sys.path.insert(0, here)
2121
sys.path.insert(0, os.path.dirname(here))
2222

23-
os.environ['DJANGO_SETTINGS_MODULE'] = 'oauth2_provider.tests.settings'
23+
os.environ["DJANGO_SETTINGS_MODULE"] = "tests.settings"
2424

2525
import django
2626
django.setup()

runtests.py

Lines changed: 0 additions & 8 deletions
This file was deleted.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
from setuptools import setup
44

55

6-
setup(test_suite="runtests")
6+
setup()
File renamed without changes.
File renamed without changes.

oauth2_provider/tests/settings.py renamed to tests/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
# Django < 1.10 compatibility
6868
MIDDLEWARE_CLASSES = MIDDLEWARE
6969

70-
ROOT_URLCONF = 'oauth2_provider.tests.urls'
70+
ROOT_URLCONF = 'tests.urls'
7171

7272
INSTALLED_APPS = (
7373
'django.contrib.auth',
@@ -78,7 +78,7 @@
7878
'django.contrib.admin',
7979

8080
'oauth2_provider',
81-
'oauth2_provider.tests',
81+
'tests',
8282
)
8383

8484
LOGGING = {

oauth2_provider/tests/test_application_views.py renamed to tests/test_application_views.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
from django.contrib.auth import get_user_model
44
from django.test import TestCase
55

6-
from ..compat import reverse
7-
from ..models import get_application_model
6+
from oauth2_provider.compat import reverse
7+
from oauth2_provider.models import get_application_model
8+
from oauth2_provider.views.application import ApplicationRegistration
9+
from oauth2_provider.settings import oauth2_settings
10+
11+
from .models import TestApplication
812

913

1014
Application = get_application_model()
@@ -28,9 +32,6 @@ def test_get_form_class(self):
2832
bound to custom application model defined in the
2933
'OAUTH2_PROVIDER_APPLICATION_MODEL' setting.
3034
"""
31-
from ..views.application import ApplicationRegistration
32-
from .models import TestApplication
33-
from ..settings import oauth2_settings
3435
# Patch oauth2 settings to use a custom Application model
3536
oauth2_settings.APPLICATION_MODEL = 'tests.TestApplication'
3637
# Create a registration view and tests that the model form is bound

oauth2_provider/tests/test_auth_backends.py renamed to tests/test_auth_backends.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
from django.utils.timezone import now, timedelta
66
from django.http import HttpResponse
77

8-
from ..models import get_application_model
9-
from ..models import AccessToken
10-
from ..backends import OAuth2Backend
11-
from ..middleware import OAuth2TokenMiddleware
8+
from oauth2_provider.models import get_application_model
9+
from oauth2_provider.models import AccessToken
10+
from oauth2_provider.backends import OAuth2Backend
11+
from oauth2_provider.middleware import OAuth2TokenMiddleware
1212
try:
1313
# Django<1.10 compatibility
1414
from django.conf.global_settings import MIDDLEWARE_CLASSES as MIDDLEWARE

oauth2_provider/tests/test_authorization_code.py renamed to tests/test_authorization_code.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
from django.test import TestCase, RequestFactory
99
from django.utils import timezone
1010

11-
from ..compat import parse_qs, reverse, urlparse, urlencode
12-
from ..models import get_application_model, Grant, AccessToken, RefreshToken
13-
from ..settings import oauth2_settings
14-
from ..views import ProtectedResourceView
11+
from oauth2_provider.compat import parse_qs, reverse, urlparse, urlencode
12+
from oauth2_provider.models import get_application_model, Grant, AccessToken, RefreshToken
13+
from oauth2_provider.settings import oauth2_settings
14+
from oauth2_provider.views import ProtectedResourceView
1515

1616
from .test_utils import TestCaseUtils
1717

oauth2_provider/tests/test_client_credential.py renamed to tests/test_client_credential.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313

1414
from oauthlib.oauth2 import BackendApplicationServer
1515

16-
from ..compat import reverse
17-
from ..models import get_application_model, AccessToken
18-
from ..oauth2_backends import OAuthLibCore
19-
from ..oauth2_validators import OAuth2Validator
20-
from ..settings import oauth2_settings
21-
from ..views import ProtectedResourceView
22-
from ..views.mixins import OAuthLibMixin
16+
from oauth2_provider.compat import reverse
17+
from oauth2_provider.models import get_application_model, AccessToken
18+
from oauth2_provider.oauth2_backends import OAuthLibCore
19+
from oauth2_provider.oauth2_validators import OAuth2Validator
20+
from oauth2_provider.settings import oauth2_settings
21+
from oauth2_provider.views import ProtectedResourceView
22+
from oauth2_provider.views.mixins import OAuthLibMixin
2323
from .test_utils import TestCaseUtils
2424

2525

0 commit comments

Comments
 (0)