Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
4687ef89
Unverified
Commit
4687ef89
authored
Jan 31, 2020
by
Sébastien Eustace
Committed by
GitHub
Jan 31, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix how repository credentials are retrieved from env vars (#1909)
# Conflicts: # poetry/utils/password_manager.py
parent
4897a70e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletions
+20
-1
poetry/utils/password_manager.py
+4
-1
tests/utils/test_password_manager.py
+16
-0
No files found.
poetry/utils/password_manager.py
View file @
4687ef89
...
@@ -155,8 +155,11 @@ class PasswordManager:
...
@@ -155,8 +155,11 @@ class PasswordManager:
def
get_http_auth
(
self
,
name
):
def
get_http_auth
(
self
,
name
):
auth
=
self
.
_config
.
get
(
"http-basic.{}"
.
format
(
name
))
auth
=
self
.
_config
.
get
(
"http-basic.{}"
.
format
(
name
))
if
not
auth
:
if
not
auth
:
username
=
self
.
_config
.
get
(
"http-basic.{}.username"
.
format
(
name
))
password
=
self
.
_config
.
get
(
"http-basic.{}.password"
.
format
(
name
))
if
not
username
and
not
password
:
return
None
return
None
else
:
username
,
password
=
auth
[
"username"
],
auth
.
get
(
"password"
)
username
,
password
=
auth
[
"username"
],
auth
.
get
(
"password"
)
if
password
is
None
:
if
password
is
None
:
password
=
self
.
keyring
.
get_password
(
name
,
username
)
password
=
self
.
keyring
.
get_password
(
name
,
username
)
...
...
tests/utils/test_password_manager.py
View file @
4687ef89
import
os
import
pytest
import
pytest
from
keyring.backend
import
KeyringBackend
from
keyring.backend
import
KeyringBackend
...
@@ -208,3 +210,17 @@ def test_keyring_with_chainer_backend_and_not_compatible_only_should_be_unavaila
...
@@ -208,3 +210,17 @@ def test_keyring_with_chainer_backend_and_not_compatible_only_should_be_unavaila
key_ring
=
KeyRing
(
"poetry"
)
key_ring
=
KeyRing
(
"poetry"
)
assert
not
key_ring
.
is_available
()
assert
not
key_ring
.
is_available
()
def
test_get_http_auth_from_environment_variables
(
environ
,
config
,
mock_available_backend
):
os
.
environ
[
"POETRY_HTTP_BASIC_FOO_USERNAME"
]
=
"bar"
os
.
environ
[
"POETRY_HTTP_BASIC_FOO_PASSWORD"
]
=
"baz"
manager
=
PasswordManager
(
config
)
auth
=
manager
.
get_http_auth
(
"foo"
)
assert
"bar"
==
auth
[
"username"
]
assert
"baz"
==
auth
[
"password"
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment