@@ -258,7 +258,13 @@ def test_project_pages_domains(gl, project):
258258 assert domain not in project .pagesdomains .list ()
259259
260260
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+
262268 p_b = project .protectedbranches .create (
263269 {
264270 "name" : "*-stable" ,
@@ -269,13 +275,14 @@ def test_project_protected_branches(project, wait_for_sidekiq):
269275 assert not p_b .allow_force_push
270276 assert p_b in project .protectedbranches .list ()
271277
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 )
276282
277283 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
279286 p_b .delete ()
280287 assert p_b not in project .protectedbranches .list ()
281288
0 commit comments