summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gitlab/mixins.py2
-rw-r--r--tests/functional/api/test_gitlab.py4
-rw-r--r--tests/functional/api/test_snippets.py2
-rw-r--r--tests/unit/test_config.py5
-rw-r--r--tests/unit/test_gitlab.py12
5 files changed, 13 insertions, 12 deletions
diff --git a/gitlab/mixins.py b/gitlab/mixins.py
index 0159ecd..916da3c 100644
--- a/gitlab/mixins.py
+++ b/gitlab/mixins.py
@@ -618,7 +618,7 @@ class AccessRequestMixin(_RestObjectBase):
)
@exc.on_http_error(exc.GitlabUpdateError)
def approve(
- self, access_level: int = gitlab.DEVELOPER_ACCESS, **kwargs: Any
+ self, access_level: int = gitlab.const.DEVELOPER_ACCESS, **kwargs: Any
) -> None:
"""Approve an access request.
diff --git a/tests/functional/api/test_gitlab.py b/tests/functional/api/test_gitlab.py
index e79492f..d54a7f1 100644
--- a/tests/functional/api/test_gitlab.py
+++ b/tests/functional/api/test_gitlab.py
@@ -118,11 +118,11 @@ def test_namespaces(gl):
def test_notification_settings(gl):
settings = gl.notificationsettings.get()
- settings.level = gitlab.NOTIFICATION_LEVEL_WATCH
+ settings.level = gitlab.const.NOTIFICATION_LEVEL_WATCH
settings.save()
settings = gl.notificationsettings.get()
- assert settings.level == gitlab.NOTIFICATION_LEVEL_WATCH
+ assert settings.level == gitlab.const.NOTIFICATION_LEVEL_WATCH
def test_user_activities(gl):
diff --git a/tests/functional/api/test_snippets.py b/tests/functional/api/test_snippets.py
index 9e0f833..ce235f3 100644
--- a/tests/functional/api/test_snippets.py
+++ b/tests/functional/api/test_snippets.py
@@ -33,7 +33,7 @@ def test_project_snippets(project):
"title": "snip1",
"file_name": "foo.py",
"content": "initial content",
- "visibility": gitlab.VISIBILITY_PRIVATE,
+ "visibility": gitlab.const.VISIBILITY_PRIVATE,
}
)
diff --git a/tests/unit/test_config.py b/tests/unit/test_config.py
index 82b9714..2bc2d25 100644
--- a/tests/unit/test_config.py
+++ b/tests/unit/test_config.py
@@ -22,7 +22,8 @@ from unittest import mock
import pytest
-from gitlab import config, USER_AGENT
+import gitlab
+from gitlab import config
custom_user_agent = "my-package/1.0.0"
@@ -252,7 +253,7 @@ def test_data_from_helper(m_open, path_exists, tmp_path):
@pytest.mark.parametrize(
"config_string,expected_agent",
[
- (valid_config, USER_AGENT),
+ (valid_config, gitlab.const.USER_AGENT),
(custom_user_agent_config, custom_user_agent),
],
)
diff --git a/tests/unit/test_gitlab.py b/tests/unit/test_gitlab.py
index 688da07..0d486e9 100644
--- a/tests/unit/test_gitlab.py
+++ b/tests/unit/test_gitlab.py
@@ -129,19 +129,19 @@ def test_gitlab_token_auth(gl, callback=None):
def test_gitlab_default_url():
gl = gitlab.Gitlab()
- assert gl.url == gitlab.DEFAULT_URL
+ assert gl.url == gitlab.const.DEFAULT_URL
@pytest.mark.parametrize(
"args, kwargs, expected_url, expected_private_token, expected_oauth_token",
[
- ([], {}, gitlab.DEFAULT_URL, None, None),
- ([None, token], {}, gitlab.DEFAULT_URL, token, None),
+ ([], {}, gitlab.const.DEFAULT_URL, None, None),
+ ([None, token], {}, gitlab.const.DEFAULT_URL, token, None),
([localhost], {}, localhost, None, None),
([localhost, token], {}, localhost, token, None),
([localhost, None, token], {}, localhost, None, token),
- ([], {"private_token": token}, gitlab.DEFAULT_URL, token, None),
- ([], {"oauth_token": token}, gitlab.DEFAULT_URL, None, token),
+ ([], {"private_token": token}, gitlab.const.DEFAULT_URL, token, None),
+ ([], {"oauth_token": token}, gitlab.const.DEFAULT_URL, None, token),
([], {"url": localhost}, localhost, None, None),
([], {"url": localhost, "private_token": token}, localhost, token, None),
([], {"url": localhost, "oauth_token": token}, localhost, None, token),
@@ -185,7 +185,7 @@ def test_gitlab_subclass_from_config(default_config):
@pytest.mark.parametrize(
"kwargs,expected_agent",
[
- ({}, gitlab.USER_AGENT),
+ ({}, gitlab.const.USER_AGENT),
({"user_agent": "my-package/1.0.0"}, "my-package/1.0.0"),
],
)