10
10
purge_expired_authz_codes ,
11
11
purge_expired_tokens ,
12
12
purge_removed_features ,
13
+ report_num_deleted_annotations ,
13
14
)
14
15
15
16
@@ -21,6 +22,21 @@ def test_purge(self, annotation_delete_service):
21
22
annotation_delete_service .bulk_delete .assert_called_once ()
22
23
23
24
25
+ @pytest .mark .usefixtures ("celery" )
26
+ class TestReportNumDeletedAnnotations :
27
+ def test_report_num_deleted_annotations (self , factories , newrelic ):
28
+ # Annotations marked as deleted, these should be counted.
29
+ factories .Annotation .create_batch (2 , deleted = True )
30
+ # An annotation not marked as deleted, this should not be counted.
31
+ factories .Annotation .create ()
32
+
33
+ report_num_deleted_annotations ()
34
+
35
+ newrelic .agent .record_custom_metric .assert_called_once_with (
36
+ "Custom/Annotations/MarkedAsDeleted" , 2
37
+ )
38
+
39
+
24
40
@pytest .mark .usefixtures ("celery" )
25
41
class TestPurgeExpiredAuthTickets :
26
42
def test_it_removes_expired_tickets (self , db_session , factories ):
@@ -141,3 +157,8 @@ def celery(patch, pyramid_request):
141
157
cel = patch ("h.tasks.cleanup.celery" , autospec = False )
142
158
cel .request = pyramid_request
143
159
return cel
160
+
161
+
162
+ @pytest .fixture (autouse = True )
163
+ def newrelic (mocker ):
164
+ return mocker .patch ("h.tasks.cleanup.newrelic" )
0 commit comments