Skip to content

Commit

Permalink
Test headers for downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
elacuesta committed Jul 7, 2024
1 parent bde837a commit 098ba0f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/tests_asyncio/test_playwright_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ async def test_logging_record_spider(self):
assert any(getattr(rec, "spider", None) is spider for rec in self._caplog.records)

@allow_windows
async def test_download_file(self):
async def test_download_file_ok(self):
settings_dict = {
"PLAYWRIGHT_BROWSER_TYPE": self.browser_type,
}
Expand All @@ -399,6 +399,7 @@ async def test_download_file(self):
response = await handler._download_request(request, Spider("foo"))
assert response.meta["playwright_suggested_filename"] == "mancha.pdf"
assert response.body.startswith(b"%PDF-1.5")
assert response.headers.get("Content-Type") == b"application/pdf"
assert handler.stats.get_value("playwright/download_count") == 1

@allow_windows
Expand Down

0 comments on commit 098ba0f

Please sign in to comment.