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
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
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'
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'