@@ -2622,7 +2622,7 @@ def test_upload_succeeds_with_wheel(
2622
2622
"content" : pretend .stub (
2623
2623
filename = filename ,
2624
2624
file = io .BytesIO (filebody ),
2625
- type = "application/tar " ,
2625
+ type = "application/octet-stream " ,
2626
2626
),
2627
2627
}
2628
2628
)
@@ -2742,6 +2742,8 @@ def test_upload_succeeds_with_wheel_after_sdist(
2742
2742
RoleFactory .create (user = user , project = project )
2743
2743
2744
2744
filename = "{}-{}-cp34-none-any.whl" .format (project .name , release .version )
2745
+ filebody = _get_whl_testdata (project .name )
2746
+ file_storage_hash = _storage_hash (filebody )
2745
2747
2746
2748
db_request .user = user
2747
2749
db_request .user_agent = "warehouse-tests/6.6.6"
@@ -2752,19 +2754,22 @@ def test_upload_succeeds_with_wheel_after_sdist(
2752
2754
"version" : release .version ,
2753
2755
"filetype" : "bdist_wheel" ,
2754
2756
"pyversion" : "cp34" ,
2755
- "md5_digest" : "335c476dc930b959dda9ec82bd65ef19" ,
2757
+ "md5_digest" : hashlib . md5 ( filebody ). hexdigest () ,
2756
2758
"content" : pretend .stub (
2757
2759
filename = filename ,
2758
- file = io .BytesIO (b"A fake file." ),
2759
- type = "application/tar " ,
2760
+ file = io .BytesIO (filebody ),
2761
+ type = "application/zip " ,
2760
2762
),
2761
2763
}
2762
2764
)
2763
2765
2764
2766
@pretend .call_recorder
2765
2767
def storage_service_store (path , file_path , * , meta ):
2766
2768
with open (file_path , "rb" ) as fp :
2767
- assert fp .read () == b"A fake file."
2769
+ if file_path .endswith (".metadata" ):
2770
+ assert fp .read () == b"Fake metadata"
2771
+ else :
2772
+ assert fp .read () == filebody
2768
2773
2769
2774
storage_service = pretend .stub (store = storage_service_store )
2770
2775
db_request .find_service = pretend .call_recorder (
@@ -2787,9 +2792,9 @@ def storage_service_store(path, file_path, *, meta):
2787
2792
pretend .call (
2788
2793
"/" .join (
2789
2794
[
2790
- "4e" ,
2791
- "6e" ,
2792
- "fa4c0ee2bbad071b4f5b5ea68f1aea89fa716e7754eb13e2314d45a5916e" ,
2795
+ file_storage_hash [: 2 ] ,
2796
+ file_storage_hash [ 2 : 4 ] ,
2797
+ file_storage_hash [ 4 :] ,
2793
2798
filename ,
2794
2799
]
2795
2800
),
@@ -2800,6 +2805,23 @@ def storage_service_store(path, file_path, *, meta):
2800
2805
"package-type" : "bdist_wheel" ,
2801
2806
"python-version" : "cp34" ,
2802
2807
},
2808
+ ),
2809
+ pretend .call (
2810
+ "/" .join (
2811
+ [
2812
+ file_storage_hash [:2 ],
2813
+ file_storage_hash [2 :4 ],
2814
+ file_storage_hash [4 :],
2815
+ filename + '.metadata' ,
2816
+ ]
2817
+ ),
2818
+ mock .ANY ,
2819
+ meta = {
2820
+ "project" : project .normalized_name ,
2821
+ "version" : release .version ,
2822
+ "package-type" : "bdist_wheel" ,
2823
+ "python-version" : "cp34" ,
2824
+ },
2803
2825
)
2804
2826
]
2805
2827
0 commit comments