Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit18c22e5

Browse files
chore: use constants from gitlab.const module
Have code use constants from the gitlab.const module instead of fromthe top-level gitlab module.
1 parentcf92904 commit18c22e5

File tree

5 files changed

+15
-13
lines changed

5 files changed

+15
-13
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
defapprove(
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
deftest_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-
assertsettings.level==gitlab.NOTIFICATION_LEVEL_WATCH
125+
assertsettings.level==gitlab.const.NOTIFICATION_LEVEL_WATCH
126126

127127

128128
deftest_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
importmock
2323
importpytest
2424

25-
fromgitlabimportconfig,USER_AGENT
25+
importgitlab
26+
fromgitlabimportconfig
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: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
importpytest
2222
fromhttmockimportHTTMock,response,urlmatch,with_httmock# noqa
2323

24-
fromgitlabimportDEFAULT_URL,Gitlab,GitlabList,USER_AGENT
24+
importgitlab
25+
fromgitlabimportGitlab,GitlabList
2526
fromgitlab.v4.objectsimportCurrentUser
2627

2728
localhost="http://localhost"
@@ -129,19 +130,19 @@ def test_gitlab_token_auth(gl, callback=None):
129130

130131
deftest_gitlab_default_url():
131132
gl=Gitlab()
132-
assertgl.url==DEFAULT_URL
133+
assertgl.url==gitlab.const.DEFAULT_URL
133134

134135

135136
@pytest.mark.parametrize(
136137
"args, kwargs, expected_url, expected_private_token, expected_oauth_token",
137138
[
138-
([], {},DEFAULT_URL,None,None),
139-
([None,token], {},DEFAULT_URL,token,None),
139+
([], {},gitlab.const.DEFAULT_URL,None,None),
140+
([None,token], {},gitlab.const.DEFAULT_URL,token,None),
140141
([localhost], {},localhost,None,None),
141142
([localhost,token], {},localhost,token,None),
142143
([localhost,None,token], {},localhost,None,token),
143-
([], {"private_token":token},DEFAULT_URL,token,None),
144-
([], {"oauth_token":token},DEFAULT_URL,None,token),
144+
([], {"private_token":token},gitlab.const.DEFAULT_URL,token,None),
145+
([], {"oauth_token":token},gitlab.const.DEFAULT_URL,None,token),
145146
([], {"url":localhost},localhost,None,None),
146147
([], {"url":localhost,"private_token":token},localhost,token,None),
147148
([], {"url":localhost,"oauth_token":token},localhost,None,token),
@@ -185,7 +186,7 @@ class MyGitlab(Gitlab):
185186
@pytest.mark.parametrize(
186187
"kwargs,expected_agent",
187188
[
188-
({},USER_AGENT),
189+
({},gitlab.const.USER_AGENT),
189190
({"user_agent":"my-package/1.0.0"},"my-package/1.0.0"),
190191
],
191192
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp