diff --git a/tests/unit/forklift/test_legacy.py b/tests/unit/forklift/test_legacy.py index 5ee550213ebf..3b798cea6353 100644 --- a/tests/unit/forklift/test_legacy.py +++ b/tests/unit/forklift/test_legacy.py @@ -1026,6 +1026,8 @@ def storage_service_store(path, file_path, *, meta): db_request.registry.settings = { "warehouse.release_files_table": "example.pypi.distributions" } + delay = pretend.call_recorder(lambda a: None) + db_request.task = pretend.call_recorder(lambda a: pretend.stub(delay=delay)) resp = legacy.file_upload(db_request) @@ -1085,6 +1087,53 @@ def storage_service_store(path, file_path, *, meta): pretend.call(update_bigquery_release_files), pretend.call(sync_file_to_cache), ] + assert delay.calls == [ + pretend.call( + { + "metadata_version": "1.2", + "name": project.name, + "version": release.version, + "summary": None, + "description": "an example description", + "author": None, + "description_content_type": None, + "author_email": None, + "maintainer": None, + "maintainer_email": None, + "license": None, + "keywords": None, + "classifiers": ["Environment :: Other Environment"], + "platform": None, + "home_page": None, + "download_url": None, + "requires_python": None, + "pyversion": "source", + "filetype": "sdist", + "comment": None, + "requires": None, + "provides": None, + "obsoletes": None, + "requires_dist": None, + "provides_dist": None, + "obsoletes_dist": None, + "requires_external": None, + "project_urls": None, + "filename": uploaded_file.filename, + "python_version": "source", + "packagetype": "sdist", + "comment_text": None, + "size": uploaded_file.size, + "has_signature": False, + "md5_digest": uploaded_file.md5_digest, + "sha256_digest": uploaded_file.sha256_digest, + "blake2_256_digest": uploaded_file.blake2_256_digest, + "path": uploaded_file.path, + "uploaded_via": "warehouse-tests/6.6.6", + "upload_time": uploaded_file.upload_time, + } + ), + pretend.call(uploaded_file.id), + ] assert metrics.increment.calls == [ pretend.call("warehouse.upload.attempt"), diff --git a/warehouse/forklift/legacy.py b/warehouse/forklift/legacy.py index 3dda986d32d8..a9c07d59c7b4 100644 --- a/warehouse/forklift/legacy.py +++ b/warehouse/forklift/legacy.py @@ -1105,7 +1105,7 @@ def file_upload(request): dist_metadata = { "metadata_version": meta.metadata_version, "name": meta.name, - "version": meta.version, + "version": str(meta.version), "summary": meta.summary, "description": meta.description, "author": meta.author,