Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_get_repository_env():
with modified_env({
'FLIT_INDEX_URL': 'https://pypi.example.com',
'FLIT_USERNAME': 'alice',
'FLIT_PASSWORD': 'p4ssword', # Also not a real password
}):
repo = upload.get_repository(cfg_file=io.StringIO(pypirc1))
# Because we haven't specified a repo name, environment variables should
# have higher priority than the config file.
assert repo['url'] == 'https://pypi.example.com'
assert repo['username'] == 'alice'
assert repo['password'] == 'p4ssword'
def test_get_repository():
repo = upload.get_repository(cfg_file=io.StringIO(pypirc1))
assert repo['url'] == upload.PYPI
assert repo['username'] == 'fred'
assert repo['password'] == 's3cret'
def test_get_repository_keyring():
with modified_env({'FLIT_PASSWORD': None}), \
_fake_keyring('tops3cret'):
repo = upload.get_repository(cfg_file=io.StringIO(pypirc2))
assert repo['username'] == 'fred'
assert repo['password'] == 'tops3cret'