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
b8f9547a
Unverified
Commit
b8f9547a
authored
Jan 05, 2021
by
John Peter Yamauchi
Committed by
GitHub
Jan 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
legacy repository: support redirected url
parent
e36fb739
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
poetry/repositories/legacy_repository.py
+11
-2
tests/repositories/test_legacy_repository.py
+15
-0
No files found.
poetry/repositories/legacy_repository.py
View file @
b8f9547a
...
@@ -387,8 +387,17 @@ class LegacyRepository(PyPiRepository):
...
@@ -387,8 +387,17 @@ class LegacyRepository(PyPiRepository):
if
response
.
status_code
in
(
401
,
403
):
if
response
.
status_code
in
(
401
,
403
):
self
.
_log
(
self
.
_log
(
"Authorization error accessing {url}"
.
format
(
url
=
url
),
level
=
"warn"
"Authorization error accessing {url}"
.
format
(
url
=
response
.
url
),
level
=
"warn"
,
)
)
return
return
return
Page
(
url
,
response
.
content
,
response
.
headers
)
if
response
.
url
!=
url
:
self
.
_log
(
"Response URL {response_url} differs from request URL {url}"
.
format
(
response_url
=
response
.
url
,
url
=
url
),
level
=
"debug"
,
)
return
Page
(
response
.
url
,
response
.
content
,
response
.
headers
)
tests/repositories/test_legacy_repository.py
View file @
b8f9547a
...
@@ -3,6 +3,7 @@ import shutil
...
@@ -3,6 +3,7 @@ import shutil
from
pathlib
import
Path
from
pathlib
import
Path
import
pytest
import
pytest
import
requests
from
poetry.core.packages
import
Dependency
from
poetry.core.packages
import
Dependency
from
poetry.factory
import
Factory
from
poetry.factory
import
Factory
...
@@ -322,3 +323,17 @@ def test_get_4xx_and_5xx_raises(http):
...
@@ -322,3 +323,17 @@ def test_get_4xx_and_5xx_raises(http):
for
endpoint
in
endpoints
:
for
endpoint
in
endpoints
:
with
pytest
.
raises
(
RepositoryError
):
with
pytest
.
raises
(
RepositoryError
):
repo
.
_get
(
endpoint
)
repo
.
_get
(
endpoint
)
def
test_get_redirected_response_url
(
http
,
monkeypatch
):
repo
=
MockHttpRepository
({
"/foo"
:
200
},
http
)
redirect_url
=
"http://legacy.redirect.bar"
def
get_mock
(
url
):
response
=
requests
.
Response
()
response
.
status_code
=
200
response
.
url
=
redirect_url
+
"/foo"
return
response
monkeypatch
.
setattr
(
repo
.
session
,
"get"
,
get_mock
)
assert
repo
.
_get
(
"/foo"
)
.
_url
==
"http://legacy.redirect.bar/foo/"
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