4
4
from django .test import override_settings
5
5
6
6
from sentry .models .files .fileblob import FileBlob
7
+ from sentry .preprod import PreprodArtifactApiAssembleGenericEvent
7
8
from sentry .preprod .models import PreprodArtifact
8
9
from sentry .tasks .assemble import AssembleTask , ChunkFileState , set_assemble_status
9
10
from sentry .testutils .auth import generate_service_request_signature
10
11
from sentry .testutils .cases import TestCase
12
+ from sentry .testutils .helpers .analytics import assert_analytics_events_recorded
11
13
12
14
13
15
@override_settings (LAUNCHPAD_RPC_SHARED_SECRET = ["test-secret-key" ])
@@ -77,10 +79,14 @@ def test_assemble_size_analysis_success(self, mock_analytics):
77
79
assert resp_data ["state" ] == ChunkFileState .CREATED
78
80
assert resp_data ["missingChunks" ] == []
79
81
80
- mock_analytics .assert_called_once_with (
81
- "preprod_artifact.api.assemble_generic" ,
82
- organization_id = self .organization .id ,
83
- project_id = self .project .id ,
82
+ assert_analytics_events_recorded (
83
+ mock_analytics ,
84
+ [
85
+ PreprodArtifactApiAssembleGenericEvent (
86
+ organization_id = self .organization .id ,
87
+ project_id = self .project .id ,
88
+ )
89
+ ],
84
90
)
85
91
self ._assert_task_called_with (mock_task , checksum , [b .checksum for b in blobs ])
86
92
@@ -104,10 +110,14 @@ def test_assemble_installable_app_success(self, mock_analytics):
104
110
assert resp_data ["state" ] == ChunkFileState .CREATED
105
111
assert resp_data ["missingChunks" ] == []
106
112
107
- mock_analytics .assert_called_once_with (
108
- "preprod_artifact.api.assemble_generic" ,
109
- organization_id = self .organization .id ,
110
- project_id = self .project .id ,
113
+ assert_analytics_events_recorded (
114
+ mock_analytics ,
115
+ [
116
+ PreprodArtifactApiAssembleGenericEvent (
117
+ organization_id = self .organization .id ,
118
+ project_id = self .project .id ,
119
+ )
120
+ ],
111
121
)
112
122
self ._assert_task_called_with (mock_task , checksum , [b .checksum for b in blobs ])
113
123
0 commit comments