@@ -30,16 +30,51 @@ def test_sigfile_for() -> None:
3030
3131
3232@pytest .mark .parametrize (
33- ["release " , "expected" ],
33+ ["text " , "expected" ],
3434 [
3535 ("3.9.0a0" , "390a0" ),
3636 ("3.10.0b3" , "3100b3" ),
3737 ("3.11.0rc2" , "3110rc2" ),
3838 ("3.12.15" , "31215" ),
39+ ("Hello, world!" , "Hello-world" ),
3940 ],
4041)
41- def test_make_slug (release : str , expected : str ) -> None :
42- assert add_to_pydotorg .make_slug (release ) == expected
42+ def test_make_slug (text : str , expected : str ) -> None :
43+ assert add_to_pydotorg .make_slug (text ) == expected
44+
45+
46+ def test_build_file_dict (tmp_path : Path ) -> None :
47+ release = "3.14.0rc2"
48+ release_url = "https://www.python.org/ftp/python/3.14.0"
49+ release_dir = tmp_path / "3.14.0"
50+ release_dir .mkdir ()
51+
52+ rfile = "test-artifact.txt"
53+ (release_dir / rfile ).write_text ("Hello world" )
54+ (release_dir / f"{ rfile } .sigstore" ).touch ()
55+
56+ assert add_to_pydotorg .build_file_dict (
57+ str (tmp_path ),
58+ release ,
59+ rfile ,
60+ 12 ,
61+ "Test artifact" ,
62+ 34 ,
63+ True ,
64+ "Test description" ,
65+ ) == {
66+ "name" : "Test artifact" ,
67+ "slug" : "3140-rc2-Test-artifact" ,
68+ "os" : "/api/v1/downloads/os/34/" ,
69+ "release" : "/api/v1/downloads/release/12/" ,
70+ "description" : "Test description" ,
71+ "is_source" : False ,
72+ "url" : f"{ release_url } /test-artifact.txt" ,
73+ "md5_sum" : "3e25960a79dbc69b674cd4ec67a72c62" ,
74+ "filesize" : 11 ,
75+ "download_button" : True ,
76+ "sigstore_bundle_file" : f"{ release_url } /test-artifact.txt.sigstore" ,
77+ }
4378
4479
4580@pytest .mark .parametrize (
0 commit comments