@@ -308,7 +308,9 @@ def setUpTestData(cls):
308
308
309
309
project = mommy .make ('Project' , users = [project_member , super_user ])
310
310
cls .label = mommy .make ('Label' , project = project )
311
+ cls .label_with_shortcut = mommy .make ('Label' , suffix_key = 'l' , project = project )
311
312
cls .url = reverse (viewname = 'label_detail' , args = [project .id , cls .label .id ])
313
+ cls .url_with_shortcut = reverse (viewname = 'label_detail' , args = [project .id , cls .label_with_shortcut .id ])
312
314
cls .data = {'text' : 'example' }
313
315
create_default_roles ()
314
316
assign_user_to_role (project_member = project_member , project = project ,
@@ -332,6 +334,12 @@ def test_allows_superuser_to_update_label(self):
332
334
response = self .client .patch (self .url , format = 'json' , data = self .data )
333
335
self .assertEqual (response .data ['text' ], self .data ['text' ])
334
336
337
+ def test_allows_superuser_to_update_label_with_shortcut (self ):
338
+ self .client .login (username = self .super_user_name ,
339
+ password = self .super_user_pass )
340
+ response = self .client .patch (self .url_with_shortcut , format = 'json' , data = {'suffix_key' : 's' })
341
+ self .assertEqual (response .data ['suffix_key' ], 's' )
342
+
335
343
def test_disallows_project_member_to_update_label (self ):
336
344
self .client .login (username = self .project_member_name ,
337
345
password = self .project_member_pass )
0 commit comments