@@ -930,7 +930,24 @@ def test_metadata_backfill(db_request, monkeypatch, metrics):
930
930
]
931
931
932
932
933
- def test_metadata_backfill_individual (db_request , monkeypatch , metrics ):
933
+ @pytest .mark .parametrize (
934
+ "path, requested_path" ,
935
+ [
936
+ # Regular path
937
+ (
938
+ "8a/6a/19...3b/pip-24.0-py3-none-any.whl" ,
939
+ "8a/6a/19...3b/pip-24.0-py3-none-any.whl" ,
940
+ ),
941
+ # Path with characters that need quoted
942
+ (
943
+ "da/5d/cc...0d/scalg-0.1.1#-py3-none-any.whl" ,
944
+ "da/5d/cc...0d/scalg-0.1.1%23-py3-none-any.whl" ,
945
+ ),
946
+ ],
947
+ )
948
+ def test_metadata_backfill_individual (
949
+ db_request , monkeypatch , metrics , path , requested_path
950
+ ):
934
951
project = ProjectFactory ()
935
952
release1 = ReleaseFactory (project = project )
936
953
release2 = ReleaseFactory (project = project )
@@ -942,7 +959,10 @@ def test_metadata_backfill_individual(db_request, monkeypatch, metrics):
942
959
)
943
960
FileFactory (release = release2 , packagetype = "sdist" )
944
961
backfillable_file = FileFactory (
945
- release = release2 , packagetype = "bdist_wheel" , metadata_file_sha256_digest = None
962
+ release = release2 ,
963
+ packagetype = "bdist_wheel" ,
964
+ metadata_file_sha256_digest = None ,
965
+ path = path ,
946
966
)
947
967
948
968
metadata_contents = b"some\n metadata\n contents"
@@ -996,7 +1016,7 @@ def mock_open(filename, perms):
996
1016
assert dist_from_wheel_url .calls == [
997
1017
pretend .call (
998
1018
project .normalized_name ,
999
- f"https://files.example.com/packages/{ backfillable_file . path } " ,
1019
+ f"https://files.example.com/packages/{ requested_path } " ,
1000
1020
stub_session ,
1001
1021
)
1002
1022
]
0 commit comments