From b325bd73400e3806e6ede59cc10011fbf138b877 Mon Sep 17 00:00:00 2001 From: David Guest Date: Thu, 26 Jul 2018 15:18:38 +1000 Subject: Added support for listing forks of a project (#562) --- tools/python_test_v4.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tools/python_test_v4.py') diff --git a/tools/python_test_v4.py b/tools/python_test_v4.py index 3b54936..79a78bc 100644 --- a/tools/python_test_v4.py +++ b/tools/python_test_v4.py @@ -467,6 +467,9 @@ fork = admin_project.forks.create({'namespace': user1.username}) p = gl.projects.get(fork.id) assert(p.forked_from_project['id'] == admin_project.id) +forks = admin_project.forks.list() +assert(fork.id in map(lambda p: p.id, forks)) + # project hooks hook = admin_project.hooks.create({'url': 'http://hook.url'}) assert(len(admin_project.hooks.list()) == 1) -- cgit v1.2.1 From 2c6c929f78dfda92d5ae93235bb9065d289a68cc Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Sat, 3 Nov 2018 09:52:21 +0100 Subject: Use the pythongitlab/test-python-gitlab docker image for tests This images is updated to the latest GitLab CE. Fix the diff() test to match the change in the API output. --- tools/python_test_v4.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/python_test_v4.py') diff --git a/tools/python_test_v4.py b/tools/python_test_v4.py index 79a78bc..133aeb3 100644 --- a/tools/python_test_v4.py +++ b/tools/python_test_v4.py @@ -390,7 +390,7 @@ data = { ] } admin_project.commits.create(data) -assert('---' in admin_project.commits.list()[0].diff()[0]['diff']) +assert('@@' in admin_project.commits.list()[0].diff()[0]['diff']) # commit status commit = admin_project.commits.list()[0] -- cgit v1.2.1 From 95d0d745d4bafe702c89c972f644b049d6c810ab Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Sat, 3 Nov 2018 09:50:37 +0100 Subject: Add support to resource label events Closes #611 --- tools/python_test_v4.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tools/python_test_v4.py') diff --git a/tools/python_test_v4.py b/tools/python_test_v4.py index 133aeb3..1a111b3 100644 --- a/tools/python_test_v4.py +++ b/tools/python_test_v4.py @@ -539,6 +539,15 @@ assert(isinstance(issue1.user_agent_detail(), dict)) assert(issue1.user_agent_detail()['user_agent']) assert(issue1.participants()) +# issues labels and events +label2 = admin_project.labels.create({'name': 'label2', 'color': '#aabbcc'}) +issue1.labels = ['label2'] +issue1.save() +events = issue1.resourcelabelevents.list() +assert(events) +event = issue1.resourcelabelevents.get(events[0].id) +assert(event) + discussion = issue1.discussions.create({'body': 'Discussion body'}) assert(len(issue1.discussions.list()) == 1) d_note = discussion.notes.create({'body': 'first note'}) @@ -628,6 +637,14 @@ d_note_from_get.delete() discussion = mr.discussions.get(discussion.id) assert(len(discussion.attributes['notes']) == 1) +# mr labels and events +mr.labels = ['label2'] +mr.save() +events = mr.resourcelabelevents.list() +assert(events) +event = mr.resourcelabelevents.get(events[0].id) +assert(event) + # basic testing: only make sure that the methods exist mr.commits() mr.changes() -- cgit v1.2.1 From ef1523a23737db45d0f439badcd8be564bcb67fb Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Sat, 24 Nov 2018 18:05:34 +0100 Subject: [feature] Add support for members all() method Closes #589 --- tools/python_test_v4.py | 1 + 1 file changed, 1 insertion(+) (limited to 'tools/python_test_v4.py') diff --git a/tools/python_test_v4.py b/tools/python_test_v4.py index 133aeb3..8ff099b 100644 --- a/tools/python_test_v4.py +++ b/tools/python_test_v4.py @@ -244,6 +244,7 @@ assert(len(group2.members.list()) == 2) group1.members.delete(user1.id) assert(len(group1.members.list()) == 2) +assert(len(group1.members.all())) member = group1.members.get(user2.id) member.access_level = gitlab.const.OWNER_ACCESS member.save() -- cgit v1.2.1 From 16bda20514e036e51bef210b565671174cdeb637 Mon Sep 17 00:00:00 2001 From: Srikanth Chelluri Date: Tue, 8 Jan 2019 22:12:25 -0500 Subject: fix: remove decode() on error_message string The integration tests failed because a test called 'decode()' on a string-type variable - the GitLabException class handles byte-to-string conversion already in its __init__. This commit removes the call to 'decode()' in the test. ``` Traceback (most recent call last): File "./tools/python_test_v4.py", line 801, in assert 'Retry later' in error_message.decode() AttributeError: 'str' object has no attribute 'decode' ``` --- tools/python_test_v4.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/python_test_v4.py') diff --git a/tools/python_test_v4.py b/tools/python_test_v4.py index 30e4456..aacb3e7 100644 --- a/tools/python_test_v4.py +++ b/tools/python_test_v4.py @@ -798,7 +798,7 @@ for i in range(20, 40): except gitlab.GitlabCreateError as e: error_message = e.error_message break -assert 'Retry later' in error_message.decode() +assert 'Retry later' in error_message [current_project.delete() for current_project in projects] settings.throttle_authenticated_api_enabled = False settings.save() -- cgit v1.2.1 From 4bd027aac41c41f7e22af93c7be0058d2faf7fb4 Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Sun, 13 Jan 2019 13:12:17 +0100 Subject: fix(api): avoid parameter conflicts with python and gitlab Provide another way to send data to gitlab with a new `query_parameters` argument. This parameter can be used to explicitly define the dict of items to send to the server, so that **kwargs are only used to specify python-gitlab specific parameters. Closes #566 Closes #629 --- tools/python_test_v4.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/python_test_v4.py') diff --git a/tools/python_test_v4.py b/tools/python_test_v4.py index aacb3e7..958e350 100644 --- a/tools/python_test_v4.py +++ b/tools/python_test_v4.py @@ -773,7 +773,7 @@ snippets = gl.snippets.list(all=True) assert(len(snippets) == 0) # user activities -gl.user_activities.list() +gl.user_activities.list(query_parameters={'from': '2019-01-01'}) # events gl.events.list() -- cgit v1.2.1