Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Backend
Commits
d113017c
Verified
Commit
d113017c
authored
1 year ago
by
Erwan Rouchet
Browse files
Options
Downloads
Patches
Plain Diff
Suppress python-gitlab UserWarning
parent
37d3a9da
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!2121
Suppress python-gitlab UserWarning
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arkindex/process/providers.py
+4
-4
4 additions, 4 deletions
arkindex/process/providers.py
arkindex/process/tests/test_gitlab_provider.py
+2
-2
2 additions, 2 deletions
arkindex/process/tests/test_gitlab_provider.py
with
6 additions
and
6 deletions
arkindex/process/providers.py
+
4
−
4
View file @
d113017c
...
...
@@ -134,13 +134,13 @@ class GitLabProvider(GitProvider):
gl
=
self
.
_get_gitlab_client
(
self
.
credentials
)
# Creating a webhook on a repo requires Maintainer (40) or Owner (50) access levels
# See https://docs.gitlab.com/ce/api/members.html#valid-access-levels
return
gl
.
projects
.
list
(
min_access_level
=
40
,
search
=
query
)
return
gl
.
projects
.
list
(
min_access_level
=
40
,
search
=
query
,
get_all
=
False
)
def
get_latest_commit_sha
(
self
,
repo
):
project
=
self
.
_get_project_from_repo
(
repo
)
# Since ref_name isn't specified, we will use the repository default branch
# See : https://docs.gitlab.com/ee/api/commits.html#list-repository-commits
return
project
.
commits
.
list
()[
0
].
id
return
project
.
commits
.
list
(
per_page
=
1
,
get_all
=
False
)[
0
].
id
def
to_dict
(
self
,
project
):
return
{
...
...
@@ -298,10 +298,10 @@ class GitLabProvider(GitProvider):
except
ValueError
:
logger
.
warning
(
f
'
{
ref_type
.
value
}
{
ref
.
name
}
was ignored during revision creation
'
)
for
branch
in
project
.
branches
.
list
():
for
branch
in
project
.
branches
.
list
(
get_all
=
True
):
_update_reference
(
branch
,
GitRefType
.
Branch
)
for
tag
in
project
.
tags
.
list
():
for
tag
in
project
.
tags
.
list
(
get_all
=
True
):
_update_reference
(
tag
,
GitRefType
.
Tag
)
def
handle_webhook
(
self
,
repo
,
request
):
...
...
This diff is collapsed.
Click to expand it.
arkindex/process/tests/test_gitlab_provider.py
+
2
−
2
View file @
d113017c
...
...
@@ -51,7 +51,7 @@ class TestGitLabProvider(FixtureTestCase):
self
.
assertEqual
(
self
.
gl_mock
().
projects
.
list
.
call_count
,
1
)
args
,
kwargs
=
self
.
gl_mock
().
projects
.
list
.
call_args
self
.
assertTupleEqual
(
args
,
())
self
.
assertDictEqual
(
kwargs
,
{
'
min_access_level
'
:
40
,
'
search
'
:
None
})
self
.
assertDictEqual
(
kwargs
,
{
'
get_all
'
:
False
,
'
min_access_level
'
:
40
,
'
search
'
:
None
})
@responses.activate
@override_settings
(
PUBLIC_HOSTNAME
=
'
https://arkindex.localhost
'
,
GITLAB_APP_ID
=
'
abcd
'
,
GITLAB_APP_SECRET
=
'
s3kr3t
'
)
...
...
@@ -102,7 +102,7 @@ class TestGitLabProvider(FixtureTestCase):
self
.
assertEqual
(
self
.
gl_mock
().
projects
.
list
.
call_count
,
1
)
args
,
kwargs
=
self
.
gl_mock
().
projects
.
list
.
call_args
self
.
assertTupleEqual
(
args
,
())
self
.
assertDictEqual
(
kwargs
,
{
'
min_access_level
'
:
40
,
'
search
'
:
'
meh
'
})
self
.
assertDictEqual
(
kwargs
,
{
'
get_all
'
:
False
,
'
min_access_level
'
:
40
,
'
search
'
:
'
meh
'
})
@override_settings
(
PUBLIC_HOSTNAME
=
'
https://arkindex.localhost
'
)
def
test_list_repos_requires_credentials
(
self
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment