summaryrefslogtreecommitdiff
path: root/gitlab/tests
diff options
context:
space:
mode:
authorNejc Habjan <nejc.habjan@siemens.com>2020-08-28 21:42:12 +0200
committerNejc Habjan <nejc.habjan@siemens.com>2020-08-28 22:19:16 +0200
commitb7a07fca775b278b1de7d5cb36c8421b7d9bebb7 (patch)
tree9cd42112139f7f3ca6db6881e5e40234540aed58 /gitlab/tests
parent4039c8cfc6c7783270f0da1e235ef5d70b420ba9 (diff)
downloadgitlab-b7a07fca775b278b1de7d5cb36c8421b7d9bebb7.tar.gz
feat(api): add endpoint for latest ref artifacts
Diffstat (limited to 'gitlab/tests')
-rw-r--r--gitlab/tests/objects/test_job_artifacts.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/gitlab/tests/objects/test_job_artifacts.py b/gitlab/tests/objects/test_job_artifacts.py
new file mode 100644
index 0000000..c501d30
--- /dev/null
+++ b/gitlab/tests/objects/test_job_artifacts.py
@@ -0,0 +1,33 @@
+"""
+GitLab API: https://docs.gitlab.com/ee/api/job_artifacts.html
+"""
+
+import pytest
+import responses
+
+from gitlab.v4.objects import Project
+
+
+ref_name = "master"
+job = "build"
+
+
+@pytest.fixture
+def resp_artifacts_by_ref_name(binary_content):
+ url = f"http://localhost/api/v4/projects/1/jobs/artifacts/{ref_name}/download?job={job}"
+
+ with responses.RequestsMock() as rsps:
+ rsps.add(
+ method=responses.GET,
+ url=url,
+ body=binary_content,
+ content_type="application/octet-stream",
+ status=200,
+ )
+ yield rsps
+
+
+def test_download_artifacts_by_ref_name(gl, binary_content, resp_artifacts_by_ref_name):
+ project = gl.projects.get(1, lazy=True)
+ artifacts = project.artifacts(ref_name=ref_name, job=job)
+ assert artifacts == binary_content