Update Django and gvacommon dependencies
This commit updates the Django dependency version to 1.9.2 and gvacommon to 0.3.0 that provides gvacommon.settings_utils.get_env_variable. The gnuviechadmin.settings.base module now uses this implementation instead of an own copy and the corresponding test has been removed too.
This commit is contained in:
parent
4b060c51f4
commit
23015af083
3 changed files with 3 additions and 49 deletions
|
@ -5,29 +5,10 @@ Common settings and globals.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from os import environ
|
|
||||||
from os.path import abspath, basename, dirname, join, normpath
|
from os.path import abspath, basename, dirname, join, normpath
|
||||||
from sys import path
|
from sys import path
|
||||||
|
|
||||||
# Normally you should not import ANYTHING from Django directly
|
from gvacommon.settings_utils import get_env_variable
|
||||||
# into your settings, but ImproperlyConfigured is an exception.
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
|
||||||
|
|
||||||
|
|
||||||
def get_env_variable(var_name):
|
|
||||||
"""
|
|
||||||
Get a setting from an environment variable.
|
|
||||||
|
|
||||||
:param str var_name: variable name
|
|
||||||
:raises ImproperlyConfigured: if the environment setting is not defined
|
|
||||||
:return: environment setting value
|
|
||||||
:rtype: str
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
return environ[var_name]
|
|
||||||
except KeyError:
|
|
||||||
error_msg = "Set the %s environment variable" % var_name
|
|
||||||
raise ImproperlyConfigured(error_msg)
|
|
||||||
|
|
||||||
|
|
||||||
# ######### PATH CONFIGURATION
|
# ######### PATH CONFIGURATION
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
"""
|
|
||||||
This module implements tests for :py:mod:`gvaldap.settings`.
|
|
||||||
|
|
||||||
"""
|
|
||||||
from __future__ import absolute_import
|
|
||||||
|
|
||||||
import os
|
|
||||||
from unittest import TestCase
|
|
||||||
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
|
||||||
|
|
||||||
from gvaldap.settings.base import get_env_variable
|
|
||||||
|
|
||||||
|
|
||||||
class GetEnvVariableTest(TestCase):
|
|
||||||
|
|
||||||
def test_get_existing_env_variable(self):
|
|
||||||
os.environ['testvariable'] = 'myvalue'
|
|
||||||
self.assertEqual(get_env_variable('testvariable'), 'myvalue')
|
|
||||||
|
|
||||||
def test_get_missing_env_variable(self):
|
|
||||||
if 'missingvariable' in os.environ:
|
|
||||||
del os.environ['missingvariable']
|
|
||||||
with self.assertRaises(ImproperlyConfigured) as e:
|
|
||||||
get_env_variable('missingvariable')
|
|
||||||
self.assertEqual(
|
|
||||||
str(e.exception), 'Set the missingvariable environment variable')
|
|
|
@ -1,4 +1,4 @@
|
||||||
Django==1.9.1
|
Django==1.9.2
|
||||||
Jinja2==2.8
|
Jinja2==2.8
|
||||||
#django-ldapdb==0.4.0
|
#django-ldapdb==0.4.0
|
||||||
-e git+https://github.com/jandd/django-ldapdb@django19#egg=django-ldapdb
|
-e git+https://github.com/jandd/django-ldapdb@django19#egg=django-ldapdb
|
||||||
|
@ -16,5 +16,5 @@ pytz==2015.7
|
||||||
passlib==1.6.5
|
passlib==1.6.5
|
||||||
requests==2.9.1
|
requests==2.9.1
|
||||||
simplejson==3.8.1
|
simplejson==3.8.1
|
||||||
-e git+https://git.gnuviech-server.de/gvacommon.git@0.2.1#egg=gvacommon
|
-e git+https://git.gnuviech-server.de/gvacommon.git@0.3.0#egg=gvacommon
|
||||||
redis==2.10.5
|
redis==2.10.5
|
||||||
|
|
Loading…
Reference in a new issue