Browse Source

Implementa e testa o settings.py utilizando o python-decouple

pull/253/head
Eduardo Calil 9 years ago
committed by Edward Ribeiro
parent
commit
940cfb802a
  1. 10
      sapl/settings.py
  2. 20
      sapl/test_config.py

10
sapl/settings.py

@ -111,17 +111,17 @@ DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': config('NAME'),
'USER': config('USER'),
'USER': config('SET_USER'),
'PASSWORD': config('PASSWORD'),
'HOST': config('HOST'),
'PORT': config('PORT'),
}
}
EMAIL_USE_TLS = config('EMAIL_USE_TLS')
EMAIL_HOST = config('EMAIL_HOST')
EMAIL_HOST_USER = config('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD')
EMAIL_USE_TLS = config('EMAIL_USE_TLS', cast=bool)
EMAIL_HOST = config('EMAIL_HOST', cast=str)
EMAIL_HOST_USER = config('EMAIL_HOST_USER', cast=str)
EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD', cast=str)
EMAIL_PORT = config('EMAIL_PORT', cast=int)
MAX_DOC_UPLOAD_SIZE = 5*1024*1024 # 5MB

20
sapl/test_config.py

@ -1,5 +1,25 @@
from .settings import EMAIL_PORT
from .settings import SECRET_KEY
from .settings import DEBUG
from .settings import DATABASES
from .settings import EMAIL_USE_TLS
from .settings import EMAIL_HOST
from .settings import EMAIL_HOST_USER
from .settings import EMAIL_HOST_PASSWORD
data = DATABASES.get('default')
def test_config():
assert EMAIL_PORT == 587
assert SECRET_KEY == '!9g1-#la+#(oft(v-y1qhy$jk-2$24pdk69#b_jfqyv!*%a_)t'
assert DEBUG is True
assert data.get('NAME') == 'sapl'
assert data.get('USER') == 'sapl'
assert data.get('PASSWORD') == 'sapl'
assert data.get('HOST') == 'localhost'
assert data.get('PORT') == '5432'
assert EMAIL_USE_TLS is True
assert EMAIL_HOST == 'smtp.interlegis.leg.br'
assert EMAIL_HOST_USER == 'sapl-test'
assert EMAIL_HOST_PASSWORD == '2BhCwbGHcZ'

Loading…
Cancel
Save