@@ -258,7 +258,13 @@ def test_project_pages_domains(gl, project):
258
258
assert domain not in project .pagesdomains .list ()
259
259
260
260
261
- def test_project_protected_branches (project , wait_for_sidekiq ):
261
+ def test_project_protected_branches (project , wait_for_sidekiq , gitlab_version ):
262
+ # Updating a protected branch is possible from Gitlab 15.6
263
+ # https://docs.gitlab.com/ee/api/protected_branches.html#update-a-protected-branch
264
+ can_update_prot_branch = gitlab_version .major > 15 or (
265
+ gitlab_version .major == 15 and gitlab_version .minor >= 6
266
+ )
267
+
262
268
p_b = project .protectedbranches .create (
263
269
{
264
270
"name" : "*-stable" ,
@@ -269,13 +275,14 @@ def test_project_protected_branches(project, wait_for_sidekiq):
269
275
assert not p_b .allow_force_push
270
276
assert p_b in project .protectedbranches .list ()
271
277
272
- p_b . allow_force_push = True
273
- p_b .save ()
274
-
275
- wait_for_sidekiq (timeout = 60 )
278
+ if can_update_prot_branch :
279
+ p_b .allow_force_push = True
280
+ p_b . save ()
281
+ wait_for_sidekiq (timeout = 60 )
276
282
277
283
p_b = project .protectedbranches .get ("*-stable" )
278
- assert p_b .allow_force_push
284
+ if can_update_prot_branch :
285
+ assert p_b .allow_force_push
279
286
p_b .delete ()
280
287
assert p_b not in project .protectedbranches .list ()
281
288
0 commit comments