File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
pulp_file/tests/functional/api Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 1+ Added content-disposition header assertions when content is consumed from an object storage.
Original file line number Diff line number Diff line change 1717from pulpcore .client .pulp_file import FileFilePublication , RepositorySyncURL
1818
1919
20+ OBJECT_STORAGES = (
21+ "storages.backends.s3boto3.S3Boto3Storage" ,
22+ "storages.backends.azure_storage.AzureStorage" ,
23+ )
24+
25+
2026def _do_range_request_download_and_assert (url , range_header , expected_bytes ):
2127 file1 = download_file (url , headers = range_header )
2228 file2 = download_file (url , headers = range_header )
@@ -111,6 +117,11 @@ def test_download_policy(
111117 actual_checksum = hashlib .sha256 (downloaded_file .body ).hexdigest ()
112118 expected_checksum = content_unit [1 ]
113119 assert expected_checksum == actual_checksum
120+ if download_policy == "immediate" and settings .DEFAULT_FILE_STORAGE in OBJECT_STORAGES :
121+ content_disposition = downloaded_file .response_obj .headers .get ("Content-Disposition" )
122+ assert content_disposition is not None
123+ filename = content_unit [0 ]
124+ assert f"attachment;filename={ filename } " == content_disposition
114125
115126 # Assert proper download with range requests smaller than one chunk of downloader
116127 range_header = {"Range" : "bytes=1048586-1049586" }
You can’t perform that action at this time.
0 commit comments