@@ -110,6 +110,33 @@ def test_content_crud(
110110 msg = "The uploaded artifact's sha256 checksum does not match the one provided"
111111 assert msg in e .value .task .error ["description" ]
112112
113+ def test_content_create_new_metadata (
114+ delete_orphans_pre , download_python_file , monitor_task , python_bindings
115+ ):
116+ """
117+ Test the creation of python content unit with newly added core metadata (provides_extra,
118+ dynamic, license_expression, license_file).
119+ """
120+ python_egg_filename = "setuptools-80.9.0.tar.gz"
121+ python_egg_url = urljoin (urljoin (PYTHON_FIXTURES_URL , "packages/" ), python_egg_filename )
122+ python_file = download_python_file (python_egg_filename , python_egg_url )
123+
124+ body = {"relative_path" : python_egg_filename , "file" : python_file }
125+ response = python_bindings .ContentPackagesApi .create (** body )
126+ task = monitor_task (response .task )
127+ content = python_bindings .ContentPackagesApi .read (task .created_resources [0 ])
128+
129+ python_package_data = {
130+ "filename" : "setuptools-80.9.0.tar.gz" ,
131+ # todo: "provides_extra" should be:
132+ # '["test", "doc", "ssl", "certs", "core", "check", "cover", "enabler", "type"]'
133+ "provides_extra" : "[]" ,
134+ "dynamic" : '["license-file"]' ,
135+ "license_expression" : "MIT" ,
136+ "license_file" : '["LICENSE"]' ,
137+ }
138+ for k , v in python_package_data .items ():
139+ assert getattr (content , k ) == v
113140
114141@pytest .mark .parallel
115142def test_upload_metadata_23_spec (python_content_factory ):
@@ -139,11 +166,13 @@ def test_upload_requires_python(python_content_factory):
139166@pytest .mark .parallel
140167def test_upload_metadata_24_spec (python_content_factory ):
141168 """Test that packages using metadata spec 2.4 can be uploaded to pulp."""
142- filename = "urllib3-2.3.0-py3-none-any.whl "
169+ filename = "setuptools-80.9.0.tar.gz "
143170 with PyPISimple () as client :
144- page = client .get_project_page ("urllib3 " )
171+ page = client .get_project_page ("setuptools " )
145172 for package in page .packages :
146173 if package .filename == filename :
147174 content = python_content_factory (filename , url = package .url )
148175 assert content .metadata_version == "2.4"
176+ assert content .license_expression == "MIT"
177+ assert content .license_file == '["LICENSE"]'
149178 break
0 commit comments