@@ -72,7 +72,7 @@ def test_post_no_signature(self):
72
72
resp = self .client .get (path )
73
73
assert resp .status_code == 404
74
74
75
- def test_post_success (self ):
75
+ def test_post_success_slug (self ):
76
76
project = self .create_project (organization = self .organization )
77
77
path = generate_signed_link (
78
78
user = self .user , viewname = self .endpoint , args = [self .organization .slug , project .id ]
@@ -88,6 +88,22 @@ def test_post_success(self):
88
88
value = "never" ,
89
89
).exists ()
90
90
91
+ def test_post_success_id (self ):
92
+ project = self .create_project (organization = self .organization )
93
+ path = generate_signed_link (
94
+ user = self .user , viewname = self .endpoint , args = [self .organization .id , project .id ]
95
+ )
96
+ resp = self .client .post (path , data = {"cancel" : "1" })
97
+ assert resp .status_code == 201
98
+ with assume_test_silo_mode (SiloMode .CONTROL ):
99
+ assert NotificationSettingOption .objects .filter (
100
+ user_id = self .user .id ,
101
+ scope_type = "project" ,
102
+ scope_identifier = project .id ,
103
+ type = "alerts" ,
104
+ value = "never" ,
105
+ ).exists ()
106
+
91
107
92
108
class OrganizationUnsubscribeIssueTest (APITestCase ):
93
109
endpoint = "sentry-api-0-organization-unsubscribe-issue"
@@ -139,7 +155,7 @@ def test_post_missing_record(self):
139
155
resp = self .client .post (path )
140
156
assert resp .status_code == 404
141
157
142
- def test_post_success (self ):
158
+ def test_post_success_slug (self ):
143
159
group = self .create_group (project = self .project )
144
160
path = generate_signed_link (
145
161
user = self .user , viewname = self .endpoint , args = [self .organization .slug , group .id ]
@@ -149,3 +165,14 @@ def test_post_success(self):
149
165
150
166
sub = GroupSubscription .objects .get (group = group , user_id = self .user .id )
151
167
assert sub .is_active is False
168
+
169
+ def test_post_success_id (self ):
170
+ group = self .create_group (project = self .project )
171
+ path = generate_signed_link (
172
+ user = self .user , viewname = self .endpoint , args = [self .organization .id , group .id ]
173
+ )
174
+ resp = self .client .post (path , data = {"cancel" : "1" })
175
+ assert resp .status_code == 201
176
+
177
+ sub = GroupSubscription .objects .get (group = group , user_id = self .user .id )
178
+ assert sub .is_active is False
0 commit comments