def test_get_credentials_config_missing_profile(self): """Test program exits if the profile supplied doesn't exist.""" stream = io.StringIO('[unt]\nusername = me\npassword = p@ss123') with patch('builtins.open', return_value=stream), \ pytest.raises(SystemExit): wc.get_credentials_config('home')
def test_get_credentials_config_missing_password(self): """Test program exits if config does not supply an expected option.""" stream = io.StringIO('[unt]\nusername = me') with patch('builtins.open', return_value=stream), \ pytest.raises(SystemExit): wc.get_credentials_config('unt')
def test_get_credentials_config(self): """Test auth can be populated from a config file.""" stream = io.StringIO('[unt]\nusername = me\npassword = p@ss123') with patch('builtins.open', return_value=stream): auth = wc.get_credentials_config('unt') assert auth == ('me', 'p@ss123')