Exemple #1
0
def test_django_db_password_should_be_correct():
    """verifies that the configured Django database uses the same password as
    NAV reads from its config file.
    """
    params = get_connection_parameters('django')
    print("get_connection_parameters: {!r}".format(params))
    print("ENVIRONMENT:\n{!r}".format(os.environ))
    print("DATABASES:\n{!r}".format(settings.DATABASES))

    host, port, db, user, password = params
    assert settings.DATABASES['default']['PASSWORD'] == password
Exemple #2
0
def test_db_password_should_not_be_blank():
    params = get_connection_parameters('default')
    print("get_connection_parameters: {!r}".format(params))
    host, port, db, user, password = params
    assert password
Exemple #3
0
                                configfolder=nav.path.sysconfdir)
except IOError:
    webfront_config = {}

DEBUG = nav_config.get('DJANGO_DEBUG',
                       'False').upper() in ('TRUE', 'YES', 'ON')
TEMPLATE_DEBUG = DEBUG

# Admins
ADMINS = (('NAV Administrator', nav_config.get('ADMIN_MAIL',
                                               'root@localhost')), )
MANAGERS = ADMINS

# Database / ORM configuration
try:
    _host, _port, _name, _user, _password = get_connection_parameters('django')
    DATABASES = {
        'default': {
            'NAME': _name,
            'ENGINE': 'django.db.backends.postgresql_psycopg2',
            'HOST': _host,
            'PORT': _port,
            'USER': _user,
            'PASSWORD': _password,
        }
    }
except IOError:
    pass

# URLs configuration
ROOT_URLCONF = 'nav.django.urls'
Exemple #4
0
                                configfolder=nav.path.sysconfdir)
except IOError:
    webfront_config = {}

DEBUG = nav_config.get('DJANGO_DEBUG', 'False').upper() in ('TRUE', 'YES', 'ON')
TEMPLATE_DEBUG = DEBUG

# Admins
ADMINS = (
    ('NAV Administrator', nav_config.get('ADMIN_MAIL', 'root@localhost')),
)
MANAGERS = ADMINS

# Database / ORM configuration
try:
    _host, _port, _name, _user, _password = get_connection_parameters('django')
    DATABASES = {
        'default': {
            'NAME': _name,
            'ENGINE': 'django.db.backends.postgresql_psycopg2',
            'HOST': _host,
            'PORT': _port,
            'USER': _user,
            'PASSWORD': _password,
        }
    }
except IOError:
    pass

# URLs configuration
ROOT_URLCONF = 'nav.django.urls'