Skip to content

Commit f59782c

Browse files
authored
Merge pull request #1708 from dev-hato/add_mock_header
ameshのタイル画像取得のMockへリクエストヘッダーの条件追加
2 parents 92c7218 + aa0bedf commit f59782c

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

tests/plugins/test_hato.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,15 @@ def get_amesh_test(
7878
os.path.join(os.path.dirname(__file__), "test.png"), mode="rb"
7979
) as picture_file:
8080
image_content = picture_file.read()
81-
for image_url in [
81+
mocker.get(
8282
re.compile(r"www\.jma\.go\.jp/bosai/jmatile/data/nowc/.+\.png"),
83+
content=image_content,
84+
)
85+
mocker.get(
8386
re.compile(r"tile\.openstreetmap\.org/.+\.png"),
84-
]:
85-
mocker.get(image_url, content=image_content)
87+
request_headers={"user-agent": f"hato-bot/{conf.VERSION}"},
88+
content=image_content,
89+
)
8690

8791
with open(
8892
os.path.join(os.path.dirname(__file__), "test_targetTimes_N1.json"),

0 commit comments

Comments
 (0)