Skip to content

Commit 6b8067e

Browse files
chore: use constants from gitlab.const module
Have code use constants from the gitlab.const module instead of from the top-level gitlab module.
1 parent c0aa0e1 commit 6b8067e

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

gitlab/mixins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ class AccessRequestMixin(_RestObjectBase):
618618
)
619619
@exc.on_http_error(exc.GitlabUpdateError)
620620
def approve(
621-
self, access_level: int = gitlab.DEVELOPER_ACCESS, **kwargs: Any
621+
self, access_level: int = gitlab.const.DEVELOPER_ACCESS, **kwargs: Any
622622
) -> None:
623623
"""Approve an access request.
624624

tests/functional/api/test_gitlab.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ def test_namespaces(gl):
118118

119119
def test_notification_settings(gl):
120120
settings = gl.notificationsettings.get()
121-
settings.level = gitlab.NOTIFICATION_LEVEL_WATCH
121+
settings.level = gitlab.const.NOTIFICATION_LEVEL_WATCH
122122
settings.save()
123123

124124
settings = gl.notificationsettings.get()
125-
assert settings.level == gitlab.NOTIFICATION_LEVEL_WATCH
125+
assert settings.level == gitlab.const.NOTIFICATION_LEVEL_WATCH
126126

127127

128128
def test_user_activities(gl):

tests/functional/api/test_snippets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_project_snippets(project):
3333
"title": "snip1",
3434
"file_name": "foo.py",
3535
"content": "initial content",
36-
"visibility": gitlab.VISIBILITY_PRIVATE,
36+
"visibility": gitlab.const.VISIBILITY_PRIVATE,
3737
}
3838
)
3939

tests/unit/test_config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222

2323
import pytest
2424

25-
from gitlab import config, USER_AGENT
25+
import gitlab
26+
from gitlab import config
2627

2728
custom_user_agent = "my-package/1.0.0"
2829

@@ -252,7 +253,7 @@ def test_data_from_helper(m_open, path_exists, tmp_path):
252253
@pytest.mark.parametrize(
253254
"config_string,expected_agent",
254255
[
255-
(valid_config, USER_AGENT),
256+
(valid_config, gitlab.const.USER_AGENT),
256257
(custom_user_agent_config, custom_user_agent),
257258
],
258259
)

tests/unit/test_gitlab.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,19 +129,19 @@ def test_gitlab_token_auth(gl, callback=None):
129129

130130
def test_gitlab_default_url():
131131
gl = gitlab.Gitlab()
132-
assert gl.url == gitlab.DEFAULT_URL
132+
assert gl.url == gitlab.const.DEFAULT_URL
133133

134134

135135
@pytest.mark.parametrize(
136136
"args, kwargs, expected_url, expected_private_token, expected_oauth_token",
137137
[
138-
([], {}, gitlab.DEFAULT_URL, None, None),
139-
([None, token], {}, gitlab.DEFAULT_URL, token, None),
138+
([], {}, gitlab.const.DEFAULT_URL, None, None),
139+
([None, token], {}, gitlab.const.DEFAULT_URL, token, None),
140140
([localhost], {}, localhost, None, None),
141141
([localhost, token], {}, localhost, token, None),
142142
([localhost, None, token], {}, localhost, None, token),
143-
([], {"private_token": token}, gitlab.DEFAULT_URL, token, None),
144-
([], {"oauth_token": token}, gitlab.DEFAULT_URL, None, token),
143+
([], {"private_token": token}, gitlab.const.DEFAULT_URL, token, None),
144+
([], {"oauth_token": token}, gitlab.const.DEFAULT_URL, None, token),
145145
([], {"url": localhost}, localhost, None, None),
146146
([], {"url": localhost, "private_token": token}, localhost, token, None),
147147
([], {"url": localhost, "oauth_token": token}, localhost, None, token),
@@ -185,7 +185,7 @@ class MyGitlab(gitlab.Gitlab):
185185
@pytest.mark.parametrize(
186186
"kwargs,expected_agent",
187187
[
188-
({}, gitlab.USER_AGENT),
188+
({}, gitlab.const.USER_AGENT),
189189
({"user_agent": "my-package/1.0.0"}, "my-package/1.0.0"),
190190
],
191191
)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy