@@ -33,12 +33,8 @@ def tearDown(self):
3333 # Clear the cache after each test
3434 cache .delete (f"ai-group-summary-v2:{ self .group .id } " )
3535
36- @patch ("sentry.seer.issue_summary.get_seer_org_acknowledgement" )
3736 @patch ("sentry.seer.issue_summary._call_seer" )
38- def test_get_issue_summary_with_existing_summary (
39- self , mock_call_seer , mock_get_acknowledgement
40- ):
41- mock_get_acknowledgement .return_value = True
37+ def test_get_issue_summary_with_existing_summary (self , mock_call_seer ):
4238 existing_summary = {
4339 "group_id" : str (self .group .id ),
4440 "headline" : "Existing headline" ,
@@ -61,29 +57,23 @@ def test_get_issue_summary_with_existing_summary(
6157 assert status_code == 200
6258 assert summary_data == convert_dict_key_case (existing_summary , snake_to_camel_case )
6359 mock_call_seer .assert_not_called ()
64- mock_get_acknowledgement .assert_called_once_with (self .group .organization .id )
6560
66- @patch ("sentry.seer.issue_summary.get_seer_org_acknowledgement" )
6761 @patch ("sentry.seer.issue_summary._get_event" )
68- def test_get_issue_summary_without_event (self , mock_get_event , mock_get_acknowledgement ):
69- mock_get_acknowledgement .return_value = True
62+ def test_get_issue_summary_without_event (self , mock_get_event ):
7063 mock_get_event .return_value = [None , None ]
7164
7265 summary_data , status_code = get_issue_summary (self .group , self .user )
7366
7467 assert status_code == 400
7568 assert summary_data == {"detail" : "Could not find an event for the issue" }
7669 assert cache .get (f"ai-group-summary-v2:{ self .group .id } " ) is None
77- mock_get_acknowledgement .assert_called_once_with (self .group .organization .id )
7870
79- @patch ("sentry.seer.issue_summary.get_seer_org_acknowledgement" )
8071 @patch ("sentry.seer.issue_summary._get_trace_connected_issues" )
8172 @patch ("sentry.seer.issue_summary._call_seer" )
8273 @patch ("sentry.seer.issue_summary._get_event" )
8374 def test_get_issue_summary_without_existing_summary (
84- self , mock_get_event , mock_call_seer , mock_get_connected_issues , mock_get_acknowledgement
75+ self , mock_get_event , mock_call_seer , mock_get_connected_issues
8576 ):
86- mock_get_acknowledgement .return_value = True
8777 event = Mock (
8878 event_id = "test_event_id" ,
8979 data = "test_event_data" ,
@@ -121,31 +111,14 @@ def test_get_issue_summary_without_existing_summary(
121111 [self .group , self .group ],
122112 [serialized_event , serialized_event ],
123113 )
124- mock_get_acknowledgement .assert_called_once_with (self .group .organization .id )
125114
126115 # Check if the cache was set correctly
127116 cached_summary = cache .get (f"ai-group-summary-v2:{ self .group .id } " )
128117 assert cached_summary == expected_response_summary
129118
130- def test_get_issue_summary_without_ai_acknowledgement (self ):
131- with patch (
132- "sentry.seer.issue_summary.get_seer_org_acknowledgement"
133- ) as mock_get_acknowledgement :
134- mock_get_acknowledgement .return_value = False
135-
136- summary_data , status_code = get_issue_summary (self .group , self .user )
137-
138- assert status_code == 403
139- assert summary_data == {
140- "detail" : "AI Autofix has not been acknowledged by the organization."
141- }
142- mock_get_acknowledgement .assert_called_once_with (self .group .organization .id )
143-
144119 @patch ("sentry.seer.issue_summary.requests.post" )
145120 @patch ("sentry.seer.issue_summary._get_event" )
146- @patch ("sentry.seer.issue_summary.get_seer_org_acknowledgement" )
147- def test_call_seer_integration (self , mock_get_acknowledgement , mock_get_event , mock_post ):
148- mock_get_acknowledgement .return_value = True
121+ def test_call_seer_integration (self , mock_get_event , mock_post ):
149122 event = Mock (
150123 event_id = "test_event_id" ,
151124 data = "test_event_data" ,
@@ -179,16 +152,11 @@ def test_call_seer_integration(self, mock_get_acknowledgement, mock_get_event, m
179152 assert status_code == 200
180153 assert summary_data == convert_dict_key_case (expected_response_summary , snake_to_camel_case )
181154 mock_post .assert_called_once ()
182- mock_get_acknowledgement .assert_called_once_with (self .group .organization .id )
183155
184156 assert cache .get (f"ai-group-summary-v2:{ self .group .id } " ) == expected_response_summary
185157
186158 @patch ("sentry.seer.issue_summary.get_issue_summary" )
187- @patch ("sentry.seer.issue_summary.get_seer_org_acknowledgement" )
188- def test_get_issue_summary_cache_write_read (
189- self , mock_get_acknowledgement , mock_get_issue_summary
190- ):
191- mock_get_acknowledgement .return_value = True
159+ def test_get_issue_summary_cache_write_read (self , mock_get_issue_summary ):
192160 # First request to populate the cache
193161 mock_get_event = Mock ()
194162 mock_call_seer = Mock ()
@@ -236,15 +204,10 @@ def test_get_issue_summary_cache_write_read(
236204 # Verify that _get_event and _call_seer were not called due to cache hit
237205 mock_get_event .assert_not_called ()
238206 mock_call_seer .assert_not_called ()
239- mock_get_acknowledgement .assert_called_with (self .group .organization .id )
240207
241208 @patch ("sentry.seer.issue_summary._generate_summary" )
242- @patch ("sentry.seer.issue_summary.get_seer_org_acknowledgement" )
243- def test_get_issue_summary_concurrent_wait_for_lock (
244- self , mock_get_acknowledgement , mock_generate_summary
245- ):
209+ def test_get_issue_summary_concurrent_wait_for_lock (self , mock_generate_summary ):
246210 """Test that a second request waits for the lock and reads from cache."""
247- mock_get_acknowledgement .return_value = True
248211 cache_key = f"ai-group-summary-v2:{ self .group .id } "
249212
250213 # Mock summary generation to take time and cache the result
@@ -305,12 +268,8 @@ def target(req_id):
305268 assert cache .get (cache_key ) == generated_summary
306269
307270 @patch ("sentry.seer.issue_summary._generate_summary" )
308- @patch ("sentry.seer.issue_summary.get_seer_org_acknowledgement" )
309- def test_get_issue_summary_concurrent_force_event_id_bypasses_lock (
310- self , mock_get_acknowledgement , mock_generate_summary
311- ):
271+ def test_get_issue_summary_concurrent_force_event_id_bypasses_lock (self , mock_generate_summary ):
312272 """Test that force_event_id bypasses lock waiting."""
313- mock_get_acknowledgement .return_value = True
314273 # Mock summary generation
315274 forced_summary = {"headline" : "Forced Summary" , "event_id" : "force_event" }
316275 mock_generate_summary .return_value = (forced_summary , 200 )
@@ -332,21 +291,17 @@ def test_get_issue_summary_concurrent_force_event_id_bypasses_lock(
332291
333292 # Ensure generation was called directly
334293 mock_generate_summary .assert_called_once ()
335- mock_get_acknowledgement .assert_called_once_with (self .group .organization .id )
336294
337295 @patch ("sentry.seer.issue_summary.cache.get" )
338296 @patch ("sentry.seer.issue_summary._generate_summary" )
339297 @patch ("sentry.utils.locking.lock.Lock.blocking_acquire" )
340- @patch ("sentry.seer.issue_summary.get_seer_org_acknowledgement" )
341298 def test_get_issue_summary_lock_timeout (
342299 self ,
343- mock_get_acknowledgement ,
344300 mock_blocking_acquire ,
345301 mock_generate_summary_core ,
346302 mock_cache_get ,
347303 ):
348304 """Test that a timeout waiting for the lock returns 503."""
349- mock_get_acknowledgement .return_value = True
350305 # Simulate lock acquisition always failing with the specific exception
351306 mock_blocking_acquire .side_effect = UnableToAcquireLock
352307 # Simulate cache miss even after timeout
@@ -362,7 +317,6 @@ def test_get_issue_summary_lock_timeout(
362317 mock_generate_summary_core .assert_not_called ()
363318 # Ensure cache was checked twice (once initially, once after lock failure)
364319 assert mock_cache_get .call_count == 2
365- mock_get_acknowledgement .assert_called_once_with (self .group .organization .id )
366320
367321 @patch ("sentry.seer.issue_summary.Project.objects.filter" )
368322 @patch ("sentry.seer.issue_summary.eventstore.backend.get_events" )
0 commit comments