@@ -902,37 +902,57 @@ def test_manifest_filter_validation(self):
902902 response = requests .put (str (url ))
903903 self .assertEqual (400 , response .status_code , response .content )
904904
905- def test_manifest_content_disposition_header (self ):
905+ @patch .object (type (config ),
906+ 'enable_bundle_notifications' ,
907+ new = PropertyMock (return_value = True ))
908+ def test_content_disposition_header_with_notifications_enabled (self ) -> None :
909+ self ._test_content_disposition_header ()
910+
911+ @patch .object (type (config ),
912+ 'enable_bundle_notifications' ,
913+ new = PropertyMock (return_value = False ))
914+ def test_content_disposition_header_with_notifications_disabled (self ) -> None :
915+ self ._test_content_disposition_header ()
916+
917+ def _test_content_disposition_header (self ):
906918 bundle_fqid = self .bundle_fqid (uuid = 'f79257a7-dfc6-46d6-ae00-ba4b25313c10' ,
907919 version = '2018-09-14T13:33:14.453337Z' )
908920 self ._index_canned_bundle (bundle_fqid )
909921 with patch .object (manifest_service , 'datetime' ) as mock_datetime :
910922 mock_datetime .now .return_value = datetime (1985 , 10 , 25 , 1 , 21 )
911923 for format in [ManifestFormat .compact ]:
912- for filters , expected_name in [
924+ source_hash = '4bc67e84-4873-591f-b524-a5fe4ec215eb'
925+ for filters , name_with_notif_enabled , name_with_notif_disabled in [
913926 # For a single project, the content disposition file name should
914927 # be the project name followed by the date and time
915928 (
916929 {'project' : {'is' : ['Single of human pancreas' ]}},
930+ 'Single of human pancreas 1985-10-25 01.21' ,
917931 'Single of human pancreas 1985-10-25 01.21'
918932 ),
919933 # In all other cases, the standard content disposition file name
920934 # should be "hca-manifest-" followed by the manifest key,
921935 # a pair of deterministically derived v5 UUIDs.
922936 (
923937 {'project' : {'is' : ['Single of human pancreas' , 'Mouse Melanoma' ]}},
924- 'hca-manifest-20d97863-d8cf-54f3-8575-0f9593d3d7ef.4bc67e84-4873-591f-b524-a5fe4ec215eb'
938+ 'hca-manifest-20d97863-d8cf-54f3-8575-0f9593d3d7ef.' + source_hash ,
939+ 'hca-manifest-9f00706c-aa4f-5ae3-80ee-5328c80b6fce.' + source_hash
925940 ),
926941 (
927942 {},
928- 'hca-manifest-c3cf398e-1927-5aae-ba2a-81d8d1800b2d.4bc67e84-4873-591f-b524-a5fe4ec215eb'
943+ 'hca-manifest-c3cf398e-1927-5aae-ba2a-81d8d1800b2d.' + source_hash ,
944+ 'hca-manifest-f2adc097-6300-5d33-9fa4-34d97d9bb39f.' + source_hash
929945 )
930946 ]:
931947 with self .subTest (filters = filters , format = format ):
932948 manifest , num_partitions = self ._get_manifest_object (format , filters )
933949 self .assertFalse (manifest .was_cached )
934950 self .assertEqual (1 , num_partitions )
935951 url = furl (self ._service .get_manifest_url (manifest ))
952+ if config .enable_bundle_notifications :
953+ expected_name = name_with_notif_enabled
954+ else :
955+ expected_name = name_with_notif_disabled
936956 expected_cd = f'attachment;filename="{ expected_name } .tsv"'
937957 actual_cd = url .args ['response-content-disposition' ]
938958 self .assertEqual (expected_cd , actual_cd )
@@ -1057,9 +1077,18 @@ def test_compact_metadata_cache(self, _time_until_object_expires: MagicMock):
10571077 self .assertEqual ([2 , 2 ], list (map (len , file_names .values ())))
10581078 self .assertEqual ([1 , 1 ], list (map (len , map (set , file_names .values ()))))
10591079
1080+ @patch .object (type (config ),
1081+ 'enable_bundle_notifications' ,
1082+ new = PropertyMock (return_value = True ))
10601083 def test_hash_validity_with_notifications_enabled (self ) -> None :
10611084 self ._test_hash_validity ()
10621085
1086+ @patch .object (type (config ),
1087+ 'enable_bundle_notifications' ,
1088+ new = PropertyMock (return_value = False ))
1089+ def test_hash_validity_with_notifications_disabled (self ) -> None :
1090+ self ._test_hash_validity ()
1091+
10631092 def _test_hash_validity (self ):
10641093 self .maxDiff = None
10651094 bundles_by_project = {
0 commit comments