Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import time
from base64 import b64encode
from math import ceil
from urllib.parse import urljoin
from uuid import uuid4

Expand All @@ -26,10 +27,12 @@ def assert_full_download(response):
assert response.status_code == 200
assert response.content
assert response.headers.get("Cache-Control") == EDGE_CACHE_CONTROL
# Last-Modified must be a real date in the past - never missing, epoch, or in the future
# aiohttp.FileResponse rounds fractional file mtimes up to the next second for Last-Modified.
# See: https://github.com/pulp/pulpcore/issues/8293
rounded_now = ceil(time.time())
last_modified = response.headers.get("Last-Modified")
assert last_modified
assert 0 < parse_http_date(last_modified) <= time.time()
assert 0 < parse_http_date(last_modified) <= rounded_now


def assert_not_modified(response):
Expand Down
Loading