@@ -71,7 +71,7 @@ def test_get_organization_seer_consent_by_org_name_no_integrations(self) -> None
71
71
"""Test when no organization integrations are found"""
72
72
# Test with a non-existent organization name
73
73
result = get_organization_seer_consent_by_org_name (org_name = "non-existent-org" )
74
- assert result == {"consent" : False }
74
+ assert result == {"consent" : False , "consent_url" : None }
75
75
76
76
def test_get_organization_seer_consent_by_org_name_no_consent (self ) -> None :
77
77
"""Test when organization exists but has no consent"""
@@ -89,7 +89,10 @@ def test_get_organization_seer_consent_by_org_name_no_consent(self) -> None:
89
89
90
90
result = get_organization_seer_consent_by_org_name (org_name = "test-org" )
91
91
92
- assert result == {"consent" : False }
92
+ assert result == {
93
+ "consent" : False ,
94
+ "consent_url" : self .organization .absolute_url ("/settings/organization/" ),
95
+ }
93
96
94
97
def test_get_organization_seer_consent_by_org_name_with_default_pr_review_enabled (self ) -> None :
95
98
"""Test when organization has seer acknowledgement"""
@@ -103,7 +106,10 @@ def test_get_organization_seer_consent_by_org_name_with_default_pr_review_enable
103
106
result = get_organization_seer_consent_by_org_name (org_name = "test-org" )
104
107
105
108
# Should return True since PR review is enabled by default
106
- assert result == {"consent" : False }
109
+ assert result == {
110
+ "consent" : False ,
111
+ "consent_url" : self .organization .absolute_url ("/settings/organization/" ),
112
+ }
107
113
108
114
def test_get_organization_seer_consent_by_org_name_multiple_orgs_one_with_consent (self ) -> None :
109
115
"""Test when multiple organizations exist, one with consent"""
@@ -158,7 +164,10 @@ def test_get_organization_seer_consent_by_org_name_with_hide_ai_features_enabled
158
164
result = get_organization_seer_consent_by_org_name (org_name = "test-org" )
159
165
160
166
# Should return False because hide_ai_features=True makes this org not contribute consent
161
- assert result == {"consent" : False }
167
+ assert result == {
168
+ "consent" : False ,
169
+ "consent_url" : self .organization .absolute_url ("/settings/organization/" ),
170
+ }
162
171
163
172
def test_get_organization_seer_consent_by_org_name_with_hide_ai_features_disabled (
164
173
self ,
@@ -174,11 +183,13 @@ def test_get_organization_seer_consent_by_org_name_with_hide_ai_features_disable
174
183
# Explicitly disable hide_ai_features
175
184
OrganizationOption .objects .set_value (self .organization , "sentry:hide_ai_features" , False )
176
185
177
- # PR review is enabled by default, so (NOT hide_ai_features AND pr_review_enabled) = True
178
186
result = get_organization_seer_consent_by_org_name (org_name = "test-org" )
179
187
180
188
# Should return False because hide_ai_features=False and PR review is disabled by default
181
- assert result == {"consent" : False }
189
+ assert result == {
190
+ "consent" : False ,
191
+ "consent_url" : self .organization .absolute_url ("/settings/organization/" ),
192
+ }
182
193
183
194
def test_get_organization_seer_consent_by_org_name_multiple_orgs_with_hide_ai_features (
184
195
self ,
@@ -210,14 +221,17 @@ def test_get_organization_seer_consent_by_org_name_multiple_orgs_with_hide_ai_fe
210
221
result = get_organization_seer_consent_by_org_name (org_name = "test-org" )
211
222
212
223
# Should return False because second org has (NOT hide_ai_features AND pr_review_enabled) = False
213
- assert result == {"consent" : False }
224
+ assert result == {
225
+ "consent" : False ,
226
+ "consent_url" : org_with_visible_ai .absolute_url ("/settings/organization/" ),
227
+ }
214
228
215
229
def test_get_organization_seer_consent_by_org_name_multiple_orgs_all_hide_ai_features (
216
230
self ,
217
231
):
218
232
"""Test multiple orgs where all have hide_ai_features=True"""
219
- org1 = self .create_organization (owner = self .user )
220
- org2 = self .create_organization (owner = self .user )
233
+ org1 = self .create_organization (owner = self .user , slug = "test-org" )
234
+ org2 = self .create_organization (owner = self .user , slug = "test-org" )
221
235
222
236
# Create integrations for both organizations with the same name
223
237
self .create_integration (
@@ -240,7 +254,10 @@ def test_get_organization_seer_consent_by_org_name_multiple_orgs_all_hide_ai_fea
240
254
result = get_organization_seer_consent_by_org_name (org_name = "test-org" )
241
255
242
256
# Should return False because no org can contribute consent (all have hide_ai_features=True)
243
- assert result == {"consent" : False }
257
+ assert result == {
258
+ "consent" : False ,
259
+ "consent_url" : org2 .absolute_url ("/settings/organization/" ),
260
+ }
244
261
245
262
def test_get_organization_seer_consent_by_org_name_hide_ai_false_pr_review_false (
246
263
self ,
@@ -262,7 +279,10 @@ def test_get_organization_seer_consent_by_org_name_hide_ai_false_pr_review_false
262
279
result = get_organization_seer_consent_by_org_name (org_name = "test-org" )
263
280
264
281
# Should return False because even though hide_ai_features=False, pr_review_enabled=False
265
- assert result == {"consent" : False }
282
+ assert result == {
283
+ "consent" : False ,
284
+ "consent_url" : self .organization .absolute_url ("/settings/organization/" ),
285
+ }
266
286
267
287
@responses .activate
268
288
@override_settings (SEER_GHE_ENCRYPT_KEY = TEST_FERNET_KEY )
0 commit comments