mirror of
https://github.com/etnguyen03/tjdests.git
synced 2025-04-20 17:50:16 -04:00
parent
22ac5bc4ba
commit
a255234173
|
@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/3.2/ref/settings/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
|
@ -46,6 +47,7 @@ INSTALLED_APPS = [
|
||||||
"social_django",
|
"social_django",
|
||||||
"django_extensions",
|
"django_extensions",
|
||||||
"bootstrap_pagination",
|
"bootstrap_pagination",
|
||||||
|
"axes",
|
||||||
"tjdests.apps.authentication",
|
"tjdests.apps.authentication",
|
||||||
"tjdests.apps.destinations",
|
"tjdests.apps.destinations",
|
||||||
"tjdests.apps.profile",
|
"tjdests.apps.profile",
|
||||||
|
@ -60,6 +62,7 @@ MIDDLEWARE = [
|
||||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||||
"django.contrib.messages.middleware.MessageMiddleware",
|
"django.contrib.messages.middleware.MessageMiddleware",
|
||||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||||
|
"axes.middleware.AxesMiddleware",
|
||||||
]
|
]
|
||||||
|
|
||||||
ROOT_URLCONF = "tjdests.urls"
|
ROOT_URLCONF = "tjdests.urls"
|
||||||
|
@ -116,6 +119,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||||
AUTH_USER_MODEL = "authentication.User"
|
AUTH_USER_MODEL = "authentication.User"
|
||||||
|
|
||||||
AUTHENTICATION_BACKENDS = (
|
AUTHENTICATION_BACKENDS = (
|
||||||
|
"axes.backends.AxesStandaloneBackend",
|
||||||
"tjdests.apps.authentication.oauth.IonOauth2",
|
"tjdests.apps.authentication.oauth.IonOauth2",
|
||||||
"django.contrib.auth.backends.ModelBackend",
|
"django.contrib.auth.backends.ModelBackend",
|
||||||
)
|
)
|
||||||
|
@ -163,6 +167,10 @@ MESSAGE_TAGS = {
|
||||||
messages.ERROR: "danger",
|
messages.ERROR: "danger",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TESTING = any("test" in arg for arg in sys.argv)
|
||||||
|
if TESTING:
|
||||||
|
AXES_ENABLED = False
|
||||||
|
|
||||||
# Override the following in secret.py
|
# Override the following in secret.py
|
||||||
SENIOR_GRAD_YEAR: int = -1
|
SENIOR_GRAD_YEAR: int = -1
|
||||||
BRANDING_NAME: str = "UNDEFINED"
|
BRANDING_NAME: str = "UNDEFINED"
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from django.http import HttpRequest
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from tjdests.apps.authentication.models import User
|
from tjdests.apps.authentication.models import User
|
||||||
|
@ -40,5 +41,7 @@ class TJDestsTestCase(TestCase):
|
||||||
"publish_data": publish_data,
|
"publish_data": publish_data,
|
||||||
},
|
},
|
||||||
)[0]
|
)[0]
|
||||||
self.client.force_login(user)
|
user.set_password("hello123")
|
||||||
|
user.save()
|
||||||
|
self.client.login(username=username, password="hello123", request=HttpRequest())
|
||||||
return user
|
return user
|
||||||
|
|
Loading…
Reference in New Issue
Block a user