| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,7 +8,7 @@ | |||
| 8 | 8 | import pytest | |
| 9 | 9 | import responses | |
| 10 | 10 | ||
| 11 | - from gitlab.v4.objects.audit_events import ProjectAudit | ||
| 11 | + from gitlab.v4.objects.audit_events import AuditEvent, ProjectAudit | ||
| 12 | 12 | ||
| 13 | 13 | id = 5 | |
| 14 | 14 | ||
@@ -32,11 +32,11 @@ | |||
| 32 | 32 | } | |
| 33 | 33 | ||
| 34 | 34 | audit_events_url = re.compile( | |
| 35 | - r"http://localhost/api/v4/((groups|projects)/1/)audit_events" | ||
| 35 | + r"http://localhost/api/v4/((groups|projects)/1/)?audit_events" | ||
| 36 | 36 | ) | |
| 37 | 37 | ||
| 38 | 38 | audit_events_url_id = re.compile( | |
| 39 | - rf"http://localhost/api/v4/((groups|projects)/1/)audit_events/{id}" | ||
| 39 | + rf"http://localhost/api/v4/((groups|projects)/1/)?audit_events/{id}" | ||
| 40 | 40 | ) | |
| 41 | 41 | ||
| 42 | 42 | ||
@@ -54,7 +54,7 @@ def resp_list_audit_events(): | |||
| 54 | 54 | ||
| 55 | 55 | ||
| 56 | 56 | @pytest.fixture | |
| 57 | - def resp_get_variable(): | ||
| 57 | + def resp_get_audit_event(): | ||
| 58 | 58 | with responses.RequestsMock() as rsps: | |
| 59 | 59 | rsps.add( | |
| 60 | 60 | method=responses.GET, | |
@@ -66,14 +66,27 @@ def resp_get_variable(): | |||
| 66 | 66 | yield rsps | |
| 67 | 67 | ||
| 68 | 68 | ||
| 69 | + def test_list_instance_audit_events(gl, resp_list_audit_events): | ||
| 70 | + audit_events = gl.audit_events.list() | ||
| 71 | + assert isinstance(audit_events, list) | ||
| 72 | + assert isinstance(audit_events[0], AuditEvent) | ||
| 73 | + assert audit_events[0].id == id | ||
| 74 | + | ||
| 75 | + | ||
| 76 | + def test_get_instance_audit_events(gl, resp_get_audit_event): | ||
| 77 | + audit_event = gl.audit_events.get(id) | ||
| 78 | + assert isinstance(audit_event, AuditEvent) | ||
| 79 | + assert audit_event.id == id | ||
| 80 | + | ||
| 81 | + | ||
| 69 | 82 | def test_list_project_audit_events(project, resp_list_audit_events): | |
| 70 | 83 | audit_events = project.audit_events.list() | |
| 71 | 84 | assert isinstance(audit_events, list) | |
| 72 | 85 | assert isinstance(audit_events[0], ProjectAudit) | |
| 73 | 86 | assert audit_events[0].id == id | |
| 74 | 87 | ||
| 75 | 88 | ||
| 76 | - def test_get_project_audit_events(project, resp_get_variable): | ||
| 89 | + def test_get_project_audit_events(project, resp_get_audit_event): | ||
| 77 | 90 | audit_event = project.audit_events.get(id) | |
| 78 | 91 | assert isinstance(audit_event, ProjectAudit) | |
| 79 | 92 | assert audit_event.id == id | |
| Back | FazBrowse Home | New Git URL |
0 commit comments