Skip to content

Commit 047f19b

Browse files
committed
update tests
1 parent df5f87b commit 047f19b

File tree

3 files changed

+247
-235
lines changed

3 files changed

+247
-235
lines changed

tests/client/files_test.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Tests for the Files endpoint.
33
"""
44

5+
from urllib.parse import urlparse
6+
57
import pytest
68
from lokalise.client import Client
79

@@ -62,7 +64,8 @@ def test_download_files(client: Client) -> None:
6264
PROJECT_ID, {"format": "json", "original_filenames": True, "replace_breaks": False}
6365
)
6466
assert response["project_id"] == PROJECT_ID
65-
assert r"amazonaws.com" in response["bundle_url"]
67+
hostname = urlparse(response["bundle_url"]).hostname
68+
assert hostname == "amazonaws.com" or (hostname and hostname.endswith(".amazonaws.com"))
6669
assert "_response_too_big" not in response
6770

6871

@@ -75,7 +78,8 @@ def test_download_files_too_big(client: Client) -> None:
7578
)
7679

7780
assert response["project_id"] == PROJECT_ID
78-
assert r"amazonaws.com" in response["bundle_url"]
81+
hostname = urlparse(response["bundle_url"]).hostname
82+
assert hostname == "amazonaws.com" or (hostname and hostname.endswith(".amazonaws.com"))
7983
assert "_response_too_big" in response
8084

8185

tests/client/screenshots_test.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Tests for the Screenshots endpoint.
33
"""
44

5+
from urllib.parse import urlparse
6+
57
import pytest
68
from lokalise.client import Client
79

@@ -41,7 +43,8 @@ def test_screenshot(client: Client) -> None:
4143
assert screenshot.screenshot_id == SCREENSHOT_ID
4244
assert screenshot.project_id == PROJECT_ID
4345
assert 34089721 in screenshot.key_ids
44-
assert "amazonaws.com" in screenshot.url
46+
hostname = urlparse(screenshot.url).hostname
47+
assert hostname == "amazonaws.com" or (hostname and hostname.endswith(".amazonaws.com"))
4548
assert screenshot.title == "screenshot"
4649
assert screenshot.description == ""
4750
assert "test" in screenshot.screenshot_tags
@@ -60,7 +63,8 @@ def test_create_screenshots(client: Client, screenshot_data: str) -> None:
6063
assert screenshots.project_id == PROJECT_ID
6164
screenshot = screenshots.items[0]
6265
assert screenshot.title == "Python screenshot"
63-
assert "amazonaws.com" in screenshot.url
66+
hostname = urlparse(screenshot.url).hostname
67+
assert hostname == "amazonaws.com" or (hostname and hostname.endswith(".amazonaws.com"))
6468

6569

6670
@pytest.mark.vcr

0 commit comments

Comments
 (0)