Skip to content

Commit aa91b2e

Browse files
committed
tests: Rename TestApplication so that pytest doesn't get confused
1 parent e590493 commit aa91b2e

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

tests/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
from oauth2_provider.models import AbstractApplication
33

44

5-
class TestApplication(AbstractApplication):
5+
class SampleApplication(AbstractApplication):
66
custom_field = models.CharField(max_length=255)

tests/test_application_views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from oauth2_provider.views.application import ApplicationRegistration
99
from oauth2_provider.settings import oauth2_settings
1010

11-
from .models import TestApplication
11+
from .models import SampleApplication
1212

1313

1414
Application = get_application_model()
@@ -33,11 +33,11 @@ def test_get_form_class(self):
3333
'OAUTH2_PROVIDER_APPLICATION_MODEL' setting.
3434
"""
3535
# Patch oauth2 settings to use a custom Application model
36-
oauth2_settings.APPLICATION_MODEL = 'tests.TestApplication'
36+
oauth2_settings.APPLICATION_MODEL = "tests.SampleApplication"
3737
# Create a registration view and tests that the model form is bound
3838
# to the custom Application model
3939
application_form_class = ApplicationRegistration().get_form_class()
40-
self.assertEqual(TestApplication, application_form_class._meta.model)
40+
self.assertEqual(SampleApplication, application_form_class._meta.model)
4141
# Revert oauth2 settings
4242
oauth2_settings.APPLICATION_MODEL = 'oauth2_provider.Application'
4343

tests/test_models.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def test_scopes_property(self):
107107
self.assertEqual(access_token2.scopes, {'write': 'Writing scope'})
108108

109109

110-
@override_settings(OAUTH2_PROVIDER_APPLICATION_MODEL='tests.TestApplication')
110+
@override_settings(OAUTH2_PROVIDER_APPLICATION_MODEL="tests.SampleApplication")
111111
class TestCustomApplicationModel(TestCase):
112112
def setUp(self):
113113
self.user = UserModel.objects.create_user("test_user", "[email protected]", "123456")
@@ -131,8 +131,7 @@ def test_related_objects(self):
131131
and f.auto_created and not f.concrete
132132
]
133133
self.assertNotIn('oauth2_provider:application', related_object_names)
134-
self.assertIn('tests%stestapplication' % (':' if django.VERSION < (1, 8) else '_'),
135-
related_object_names)
134+
self.assertIn("tests_sampleapplication", related_object_names)
136135

137136

138137
class TestGrantModel(TestCase):

0 commit comments

Comments
 (0)