8000 feat: add project audit endpoint by Sineaggi · Pull Request #1308 · python-gitlab/python-gitlab · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@Sineaggi
Copy link

Similar to #949 but specific to project audit events.

No previous issues for this exist.

The code was tested to verify it works.

Copy link
Member
@nejch nejch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this @Sineaggi! Just one small comment.

BTW - It might make sense to separate this into its own module, audit_events.py. Looking at the upstream docs, we also have instance and group audit events, so this could be expanded at a later point, and look something like the variables module:

https://github.com/python-gitlab/python-gitlab/blob/master/gitlab/v4/objects/variables.py

EDIT: I realize now that the current instance-level audit events were put into events.py, but they seem to have their own section in gitlab's api, so moving them together into audit_events.py might still make sense.

Then import the project-specific classes in projects.py.

If you feel like it, you could also add some unit tests for this as a sanity check, using the example responses from your API link as mocks. Have a look at the existing unit tests: https://github.com/python-gitlab/python-gitlab/tree/master/gitlab/tests/objects

Thanks again!

@Sineaggi Sineaggi force-pushed the add-project-audit-endpoint branch from 1f5c5bf to dba3483 Compare February 19, 2021 21:04
@codecov-io
Copy link
codecov-io commented Feb 19, 2021

Codecov Report

Merging #1308 (6660dbe) into master (d4e7a03) will increase coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1308      +/-   ##
==========================================
+ Coverage   80.64%   80.71%   +0.06%     
==========================================
  Files          66       67       +1     
  Lines        3250     3261      +11     
==========================================
+ Hits         2621     2632      +11     
  Misses        629      629              
Flag Coverage Δ
unit 80.71% <100.00%> (+0.06%) ⬆️

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

Impacted Files Coverage Δ
gitlab/v4/objects/audit_events.py 100.00% <100.00%> (ø)
gitlab/v4/objects/projects.py 69.09% <100.00%> (+0.11%) ⬆️

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 d4e7a03...6660dbe. Read the comment docs.

@Sineaggi Sineaggi requested a review from nejch February 19, 2021 21:05
@Sineaggi
Copy link
Author

@nejch code moved to audit_events.py, moved to RetrieveMixin, added tests that execute both .get() and .list()

@Sineaggi Sineaggi force-pushed the add-project-audit-endpoint branch from dba3483 to 868cea9 Compare February 19, 2021 21:49
@Sineaggi Sineaggi force-pushed the add-project-audit-endpoint branch from 868cea9 to 6660dbe Compare February 19, 2021 21:55
Copy link
Member
@nejch nejch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again! Just found a little copy/paste leftover, I can push this.

@nejch nejch merged commit 0c5a23e into python-gitlab:master Feb 20, 2021
@Sineaggi Sineaggi deleted the add-project-audit-endpoint branch February 20, 2021 20:14
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.

3 participants

0