def test_env_as_list__using_str(self): self.assertListEqual([], env_as_list('DUMMY_ENV')) self.assertListEqual([], env_as_list('DUMMY_ENV', '')) self.assertListEqual([], env_as_list('DUMMY_ENV', ' ')) self.assertListEqual(['a'], env_as_list('DUMMY_ENV', 'a')) self.assertListEqual(['a', 'b'], env_as_list('DUMMY_ENV', 'a,b')) self.assertListEqual(['a', 'b'], env_as_list('DUMMY_ENV', 'a;b', delimiter=';')) os.environ['ALIST'] = 'c,d' self.assertListEqual(['c', 'd'], env_as_list('ALIST', '')) os.environ['ALIST'] = 'c;d' self.assertListEqual(['c', 'd'], env_as_list('ALIST', '', delimiter=';'))
def test_env_as_list__using_tuple(self): self.assertListEqual([], env_as_list('DUMMY_ENV', tuple())) self.assertListEqual(['a'], env_as_list('DUMMY_ENV', tuple('a'))) self.assertListEqual(['a', 'b'], env_as_list('DUMMY_ENV', ('a', 'b'))) self.assertListEqual(['a', 'b'], env_as_list('DUMMY_ENV', ('a', 'b'), delimiter=';')) os.environ['ALIST'] = 'c,d' self.assertListEqual(['c', 'd'], env_as_list('ALIST', ('c', 'd'))) os.environ['ALIST'] = 'c;d' self.assertListEqual(['c', 'd'], env_as_list('ALIST', ('c', 'd'), delimiter=';'))
def test_env_as_list__using_none(self): self.assertIsNone(env_as_list('DUMMY_ENV', None))
'class': 'logging.StreamHandler', 'formatter': 'console', }, }, 'loggers': { '': { 'level': LOGLEVEL, 'handlers': [ 'console', ], }, }, }) # Apps MY_APPS = env_as_list('MY_APPS', 'avaportal,suap_ead') THIRD_APPS = env_as_list('THIRD_APPS', 'social_django,tabbed_admin,markdownx') DJANGO_APPS = env_as_list( 'DJANGO_APPS', 'django.contrib.admin,' 'django.contrib.auth,' 'django.contrib.contenttypes,' 'django.contrib.sessions,' 'django.contrib.messages,' 'django.contrib.staticfiles') INSTALLED_APPS = MY_APPS + THIRD_APPS + DJANGO_APPS # Middleware MIDDLEWARE = [ 'avaportal.middleware.GoToHTTPSMiddleware', # <- 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
SOCIAL_AUTH_SUAP_ACCESS_TOKEN_METHOD = env( 'SOCIAL_AUTH_SUAP_ACCESS_TOKEN_METHOD', 'POST') SOCIAL_AUTH_SUAP_ACCESS_TOKEN_URL = env('SOCIAL_AUTH_SUAP_ACCESS_TOKEN_URL', 'https://suap.ifrn.edu.br/o/token/') SOCIAL_AUTH_SUAP_ID_KEY = env('SOCIAL_AUTH_SUAP_ID_KEY', 'identificacao') SOCIAL_AUTH_SUAP_RESPONSE_TYPE = env('SOCIAL_AUTH_SUAP_RESPONSE_TYPE', 'code') SOCIAL_AUTH_SUAP_REDIRECT_STATE = env_as_bool( 'SOCIAL_AUTH_SUAP_REDIRECT_STATE', True) SOCIAL_AUTH_SUAP_STATE_PARAMETER = env_as_bool( 'SOCIAL_AUTH_SUAP_STATE_PARAMETER', True) SOCIAL_AUTH_SUAP_USER_DATA_URL = env('SOCIAL_AUTH_SUAP_USER_DATA_URL', 'https://suap.ifrn.edu.br/api/eu/') SOCIAL_AUTH_SUAP_AUTO_CREATE = env_as_bool('SOCIAL_AUTH_SUAP_AUTO_CREATE', False) SOCIAL_AUTH_SUAP_AUTO_CREATE_AS_STAFF = env_as_bool( 'SOCIAL_AUTH_SUAP_AUTO_CREATE_AS_STAFF', False) SOCIAL_AUTH_SUAP_EXTRA_CONTEXT_PROCESSORS = env_as_list( 'SOCIAL_AUTH_SUAP_EXTRA_CONTEXT_PROCESSORS', 'social_django.context_processors.backends,' 'social_django.context_processors.login_redirect') SUAPINTEGRATION_APPS = env_as_list('SUAPINTEGRATION_APPS', 'suapintegration,social_django') AUTHENTICATION_BACKENDS = env_as_list('DJANGO_AUTHENTICATION_BACKENDS', 'suapintegration.backends.SuapOAuth2') AUTH_USER_MODEL = env('DJANGO_AUTH_USER_MODEL', 'suapintegration.SuapUser') LOGIN_URL = env('DJANGO_LOGIN_URL', '/oauth/login/suap/') LOGIN_REDIRECT_URL = env('DJANGO_LOGIN_REDIRECT_URL', '/') LOGOUT_URL = env('DJANGO_LOGOUT_URL', '/logout/') LOGOUT_REDIRECT_URL = env("DJANGO_LOGOUT_REDIRECT_URL", LOGIN_REDIRECT_URL)
'handlers': ['console'] } if env_as_bool('DJANGO_DEBUG_LDAP', False): LOGGING['loggers']['django_auth_ldap'] = { 'level': 'DEBUG', 'handlers': ['console'] } DEBUG_TOOLBAR_CONFIG = { 'SHOW_TOOLBAR_CALLBACK': lambda request: request.get_host() in ['localhost', '127.0.0.1', 'sso'], } # Apps MY_APPS = env_as_list('MY_APPS', '') SUAP_EAD_LIBS = env_as_list('SUAP_EAD_LIBS', 'suap_ead') DEV_APPS = env_as_list('DEV_APPS', 'debug_toolbar,django_extensions' if DEBUG else '') THIRD_APPS = env_as_list('THIRD_APPS', 'rest_framework_swagger,' 'rest_framework') DJANGO_APPS = env_as_list( 'DJANGO_APPS', 'django.contrib.admin,' 'django.contrib.auth,' 'django.contrib.contenttypes,' 'django.contrib.sessions,' 'django.contrib.messages,' 'django.contrib.staticfiles') INSTALLED_APPS = MY_APPS + SUAP_EAD_LIBS + THIRD_APPS + DEV_APPS + DJANGO_APPS # Middleware