Code cleanup
This commit is contained in:
parent
a47edbfa03
commit
822f7fb74c
@ -33,4 +33,5 @@ class UserFactory(DjangoModelFactory):
|
|||||||
class ServiceFactory(DjangoModelFactory):
|
class ServiceFactory(DjangoModelFactory):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Service
|
model = Service
|
||||||
|
|
||||||
name = factory.Faker("company")
|
name = factory.Faker("company")
|
||||||
|
@ -7,7 +7,6 @@ from dashboard.views import DashboardView
|
|||||||
|
|
||||||
|
|
||||||
class QuestionModelTests(TestCase):
|
class QuestionModelTests(TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
# Every test needs access to the request factory.
|
# Every test needs access to the request factory.
|
||||||
self.factory = RequestFactory()
|
self.factory = RequestFactory()
|
||||||
@ -23,12 +22,11 @@ class QuestionModelTests(TestCase):
|
|||||||
THEN: It's redirected to login page with NEXT url to dashboard
|
THEN: It's redirected to login page with NEXT url to dashboard
|
||||||
"""
|
"""
|
||||||
login_url = settings.LOGIN_URL
|
login_url = settings.LOGIN_URL
|
||||||
response = self.client.get(reverse('dashboard:dashboard'))
|
response = self.client.get(reverse("dashboard:dashboard"))
|
||||||
|
|
||||||
self.assertEqual(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
response.url,
|
response.url, f"{login_url}?next={reverse('dashboard:dashboard')}"
|
||||||
f"{login_url}?next={reverse('dashboard:dashboard')}"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def tests_authenticated_dashboard_view(self):
|
def tests_authenticated_dashboard_view(self):
|
||||||
@ -37,7 +35,7 @@ class QuestionModelTests(TestCase):
|
|||||||
WHEN: Accessing the dashboard view
|
WHEN: Accessing the dashboard view
|
||||||
THEN: It should respond with 200 and render the view
|
THEN: It should respond with 200 and render the view
|
||||||
"""
|
"""
|
||||||
request = self.factory.get(reverse('dashboard:dashboard'))
|
request = self.factory.get(reverse("dashboard:dashboard"))
|
||||||
request.user = self.user
|
request.user = self.user
|
||||||
|
|
||||||
# Use this syntax for class-based views.
|
# Use this syntax for class-based views.
|
||||||
|
@ -299,7 +299,7 @@ else:
|
|||||||
EMAIL_USE_TLS = os.environ.get("EMAIL_USE_TLS")
|
EMAIL_USE_TLS = os.environ.get("EMAIL_USE_TLS")
|
||||||
|
|
||||||
# Auto fields
|
# Auto fields
|
||||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||||
|
|
||||||
# NPM
|
# NPM
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user