Commit c0d6d7bc by Sébastien Eustace

Fix tests

parent cf16c392
import pytest import pytest
import shutil
from poetry.masonry.publishing.uploader import UploadError from poetry.masonry.publishing.uploader import UploadError
from poetry.masonry.publishing.uploader import Uploader from poetry.masonry.publishing.uploader import Uploader
...@@ -12,12 +11,12 @@ fixtures_dir = Path(__file__).parent.parent.parent / "fixtures" ...@@ -12,12 +11,12 @@ fixtures_dir = Path(__file__).parent.parent.parent / "fixtures"
def project(name): def project(name):
return Path(__file__).parent / "fixtures" / name return fixtures_dir / name
def test_uploader_properly_handles_400_errors(http): def test_uploader_properly_handles_400_errors(http):
http.register_uri(http.POST, "https://foo.com", status=400, body="Bad request") http.register_uri(http.POST, "https://foo.com", status=400, body="Bad request")
uploader = Uploader(Poetry.create(project("simple-project")), NullIO()) uploader = Uploader(Poetry.create(project("simple_project")), NullIO())
with pytest.raises(UploadError) as e: with pytest.raises(UploadError) as e:
uploader.upload("https://foo.com") uploader.upload("https://foo.com")
...@@ -27,7 +26,7 @@ def test_uploader_properly_handles_400_errors(http): ...@@ -27,7 +26,7 @@ def test_uploader_properly_handles_400_errors(http):
def test_uploader_properly_handles_403_errors(http): def test_uploader_properly_handles_403_errors(http):
http.register_uri(http.POST, "https://foo.com", status=403, body="Unauthorized") http.register_uri(http.POST, "https://foo.com", status=403, body="Unauthorized")
uploader = Uploader(Poetry.create(project("simple-project")), NullIO()) uploader = Uploader(Poetry.create(project("simple_project")), NullIO())
with pytest.raises(UploadError) as e: with pytest.raises(UploadError) as e:
uploader.upload("https://foo.com") uploader.upload("https://foo.com")
...@@ -40,7 +39,7 @@ def test_uploader_registers_for_appropriate_400_errors(mocker, http): ...@@ -40,7 +39,7 @@ def test_uploader_registers_for_appropriate_400_errors(mocker, http):
http.register_uri( http.register_uri(
http.POST, "https://foo.com", status=400, body="No package was ever registered" http.POST, "https://foo.com", status=400, body="No package was ever registered"
) )
uploader = Uploader(Poetry.create(project("simple-project")), NullIO()) uploader = Uploader(Poetry.create(project("simple_project")), NullIO())
with pytest.raises(UploadError): with pytest.raises(UploadError):
uploader.upload("https://foo.com") uploader.upload("https://foo.com")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment