Beispiel #1
0
def test_get_config_config_not_exist(mock_config_template, mock_fs):
    """Test that config template is copied over to user config."""
    with pytest.raises(SystemExit), \
            mock.patch.object(config, 'copyfileobj') as copyfileobj:
        config.get_config()

    assert copyfileobj.called, 'Template should be copied to user config.'
Beispiel #2
0
def test_get_config_missing_values(mock_config_template, mock_config,
                                   mock_fs):  # pragma: no cover
    """Test that config will default to values from template if user did not override."""
    mock_config.write_text(
        dedent('''\
        ---
        email_address: '*****@*****.**'
    '''))

    _config = config.get_config()

    assert _config[
        'email_address'] == '*****@*****.**', 'email_address should come from user config override.'
    assert not _config[
        'use_keyring'], 'use_keyring should be default value from template.'
Beispiel #3
0
def get_mealpal_credentials():
    email = config.get_config()['email_address']
    password = getpass.getpass('Enter password: ')
    return email, password
Beispiel #4
0
def test_get_config_override(mock_config_template, mock_config, mock_fs):
    """Test that user config values override default values."""
    _config = config.get_config()

    assert _config['email_address'] == '*****@*****.**'