forked from yunojuno/django-highrise
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_settings.py
62 lines (55 loc) · 1.65 KB
/
test_settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"""
Simplest possible settings.py for use in running django_highrise unit tests.
This settings file would be completely useless for running a project, however
it has enough in it to be able to run the django unit test runner, and to spin
up django.contrib.auth users (as required by django_highrise).
In order for the tests to run, you will need to set the following environment
variables: HIGHRISE_SERVER and HIGHRISE_API_KEY.
Please see online documentation for more details.
"""
from os import environ as env
from sys import exit
import logging
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'delme'
}
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django_highrise'
)
# this isn't used, however the django_highrise app does reference a logger,
# so although the tests will run without this, some warnings will appear.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'simple': {
'format': '%(levelname)s %(message)s'
},
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'simple'
},
},
'loggers': {
'': {
'handlers': ['console'],
'propagate': False,
'level': 'DEBUG',
},
}
}
try:
HIGHRISE_SERVER = env['HIGHRISE_SERVER']
HIGHRISE_API_KEY = env['HIGHRISE_API_KEY']
except KeyError:
logging.error("Missing environment variables HIGHRISE_SERVER and "
"HIGHRISE_API_KEY. Please set these before attempting to run tests.")
exit(1)