Skip to content

Commit

Permalink
Set DEFAULT_PAGINATION_CLASS in tests.settings to silence `rest_f…
Browse files Browse the repository at this point in the history
…ramework.W001` warning
  • Loading branch information
ernestofgonzalez committed Sep 21, 2021
1 parent b3b0386 commit 25160e4
Showing 1 changed file with 35 additions and 36 deletions.
71 changes: 35 additions & 36 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,65 @@

BASE_DIR = os.path.dirname(__file__)

SECRET_KEY = 'test'
INSTALL_DIR = '/usr/local/altschool/dynamic-rest/'
SECRET_KEY = "test"
INSTALL_DIR = "/usr/local/altschool/dynamic-rest/"

STATIC_URL = '/static/'
STATIC_ROOT = os.environ.get('STATIC_ROOT', INSTALL_DIR + 'www/static')
STATIC_URL = "/static/"
STATIC_ROOT = os.environ.get("STATIC_ROOT", INSTALL_DIR + "www/static")

ENABLE_INTEGRATION_TESTS = os.environ.get('ENABLE_INTEGRATION_TESTS', False)
ENABLE_INTEGRATION_TESTS = os.environ.get("ENABLE_INTEGRATION_TESTS", False)

DEBUG = True

DATABASES = {}
if os.environ.get('DATABASE_URL'):
if os.environ.get("DATABASE_URL"):
# remote database
import dj_database_url
DATABASES['default'] = dj_database_url.config()

DATABASES["default"] = dj_database_url.config()
else:
# local sqlite database file
DATABASES['default'] = {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': ''
DATABASES["default"] = {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
"USER": "",
"PASSWORD": "",
"HOST": "",
"PORT": "",
}

INSTALLED_APPS = (
'rest_framework',
'django.contrib.staticfiles',
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.sites',
'dynamic_rest',
'tests',
"rest_framework",
"django.contrib.staticfiles",
"django.contrib.contenttypes",
"django.contrib.auth",
"django.contrib.sites",
"dynamic_rest",
"tests",
)

REST_FRAMEWORK = {
'PAGE_SIZE': 50,
'DEFAULT_RENDERER_CLASSES': (
'rest_framework.renderers.JSONRenderer',
'dynamic_rest.renderers.DynamicBrowsableAPIRenderer'
)
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.PageNumberPagination",
"PAGE_SIZE": 50,
"DEFAULT_RENDERER_CLASSES": (
"rest_framework.renderers.JSONRenderer",
"dynamic_rest.renderers.DynamicBrowsableAPIRenderer",
),
}

ROOT_URLCONF = 'tests.urls'
ROOT_URLCONF = "tests.urls"

STATICFILES_DIRS = (
os.path.abspath(os.path.join(BASE_DIR, '../dynamic_rest/static')),
)
STATICFILES_DIRS = (os.path.abspath(os.path.join(BASE_DIR, "../dynamic_rest/static")),)

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': os.path.abspath(os.path.join(BASE_DIR,
'../dynamic_rest/templates')),
'APP_DIRS': True,
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": os.path.abspath(os.path.join(BASE_DIR, "../dynamic_rest/templates")),
"APP_DIRS": True,
}
]

DYNAMIC_REST = {
'ENABLE_LINKS': True,
'DEBUG': os.environ.get('DYNAMIC_REST_DEBUG', 'false').lower() == 'true'
"ENABLE_LINKS": True,
"DEBUG": os.environ.get("DYNAMIC_REST_DEBUG", "false").lower() == "true",
}

0 comments on commit 25160e4

Please sign in to comment.