Skip to content

Conversation

@daniellanner
Copy link
Contributor

@daniellanner daniellanner commented Apr 30, 2021

Add ProjectProtectedBranchManager.code_owner_approval_required to mimick GitLab API documentation:

Attribute Type Required Description
code_owner_approval_required boolean no Prevent pushes to this branch if it matches an item in the CODEOWNERS file. (defaults: false)

Fixes #1436

The python API was missing the field code_owner_approval_required
as implemented in the GitLab REST API.
@JohnVillalovos
Copy link
Member

A test for this would be awesome. Maybe in the functional tests. For an example see: https://github.com/python-gitlab/python-gitlab/blob/master/tools/functional/api/test_projects.py#L190

@codecov-commenter
Copy link

Codecov Report

Merging #1437 (fdc46ba) into master (09ef8d4) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1437   +/-   ##
=======================================
  Coverage   80.24%   80.24%           
=======================================
  Files          73       73           
  Lines        4064     4064           
=======================================
  Hits         3261     3261           
  Misses        803      803           
Flag Coverage Δ
unit 80.24% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
gitlab/v4/objects/branches.py 73.52% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 09ef8d4...fdc46ba. Read the comment docs.

@nejch
Copy link
Member

nejch commented May 1, 2021

A test for this would be awesome. Maybe in the functional tests. For an example see: https://github.com/python-gitlab/python-gitlab/blob/master/tools/functional/api/test_projects.py#L190

@JohnVillalovos in this case I think we won't be able to test it in functional tests, as it's a premium feature and our CE docker container won't return the attribute.

Edit: I'll merge this for now John, as writing tests for all attributes would get tedious unless we need to test something specific around their behavior (like our list issue), but we should definitely think about how to maintain these hardcoded attributes better.

Since GitLab doesn't have an OpenAPI spec, maybe by periodically scanning the markdown tables from their docs for required/optional args for all endpoints and checking against our tuples, lol

@nejch nejch merged commit d61e669 into python-gitlab:master May 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing API code owner approval for protected branches

4 participants