1010 OrganizationLevelTokenFactory ,
1111)
1212from shared .django_apps .core .tests .factories import CommitFactory , RepositoryFactory
13+ from shared .events .amplitude import UNKNOWN_USER_OWNERID
1314
1415from core .models import Commit
1516from services .redis_configuration import get_redis_connection
@@ -27,6 +28,9 @@ def test_upload_bundle_analysis_success(db, client, mocker, mock_redis):
2728 "shared.storage.MinioStorageService.create_presigned_put" ,
2829 return_value = "test-presigned-put" ,
2930 )
31+ mock_amplitude = mocker .patch (
32+ "shared.events.amplitude.AmplitudeEventPublisher.publish"
33+ )
3034
3135 repository = RepositoryFactory .create ()
3236 commit_sha = "6fd5b89357fc8cdf34d6197549ac7c6d7e5977ef"
@@ -103,6 +107,19 @@ def test_upload_bundle_analysis_success(db, client, mocker, mock_redis):
103107 },
104108 )
105109
110+ # emits Amplitude event
111+ mock_amplitude .assert_called_with (
112+ "Upload Received" ,
113+ {
114+ "user_ownerid" : UNKNOWN_USER_OWNERID ,
115+ "ownerid" : commit .repository .author .ownerid ,
116+ "repoid" : commit .repository .repoid ,
117+ "commitid" : commit .id ,
118+ "pullid" : commit .pullid ,
119+ "upload_type" : "Bundle" ,
120+ },
121+ )
122+
106123
107124@pytest .mark .django_db (databases = {"default" , "timeseries" })
108125@override_settings (SHELTER_SHARED_SECRET = "shelter-shared-secret" )
0 commit comments