Пример #1
0
def test_git_settings():
    rc_lines = [('SETTINGS_DIR = "%s"\n' % settings_dir),
                'APP_MODE = "prod"\n',
                ('GIT_SETTINGS_REPO = "%s"\n' % repo_dir),
                ('GIT_SETTINGS_SUBDIR = "%s"\n' % git_settings_subdir)
                ]
    open('.convergerc', 'w').writelines(rc_lines)
    settings.reload()
    assert settings.PROD is True
Пример #2
0
def test_rc():
    rc_lines = [('SETTINGS_DIR = "%s"\n' % settings_dir), 'APP_MODE = "dev"\n']
    open('.convergerc', 'w').writelines(rc_lines)

    os.makedirs(settings_dir)
    open(os.path.join(settings_dir, '__init__.py'), 'w').close()
    open(os.path.join(settings_dir, '../', '__init__.py'), 'w').close()

    config_path = os.path.join(settings_dir, 'default_settings.py')
    create_config_file(config_path, default_config)
    settings.reload()
    assert settings.config == 'default'

    config_path = os.path.join(settings_dir, 'dev_settings.py')
    create_config_file(config_path, dev_config)
    settings.reload()
    assert settings.config == 'dev'

    config_path = os.path.join(settings_dir, 'prod_settings.py')
    create_config_file(config_path, prod_config)
    settings.reload()
    assert settings.config == 'dev'

    config_path = os.path.join(settings_dir, 'site_settings.py')
    create_config_file(config_path, site_config)
    settings.reload()
    assert settings.config == 'site'
Пример #3
0
def test_no_settings_dir():
    assert settings.get('config') is None, settings.get('config')
    create_config_file('default_settings.py', default_config)
    settings.reload()
    assert settings.get('config') == 'default', settings.get('config')