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

Commit00aec96

Browse files
nejchJohnVillalovos
authored andcommitted
test: increase client coverage
1 parent3d000d3 commit00aec96

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

‎tests/functional/api/test_gitlab.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ def test_markdown(gl):
3535
assert"foo"inhtml
3636

3737

38+
deftest_markdown_in_project(gl,project):
39+
html=gl.markdown("foo",project=project.path_with_namespace)
40+
assert"foo"inhtml
41+
42+
3843
deftest_lint(gl):
3944
success,errors=gl.lint("Invalid")
4045
assertsuccessisFalse
@@ -127,6 +132,11 @@ def test_notification_settings(gl):
127132
assertsettings.level==gitlab.const.NOTIFICATION_LEVEL_WATCH
128133

129134

135+
deftest_search(gl):
136+
result=gl.search(scope=gitlab.const.SEARCH_SCOPE_USERS,search="Administrator")
137+
assertresult[0]["id"]==1
138+
139+
130140
deftest_user_activities(gl):
131141
activities=gl.user_activities.list(query_parameters={"from":"2019-01-01"})
132142
assertisinstance(activities,list)
@@ -237,3 +247,8 @@ def test_list_as_list_false_warnings(gl):
237247
forwarningincaught_warnings:
238248
assertisinstance(warning.message,DeprecationWarning)
239249
assertlen(list(items))>20
250+
251+
252+
deftest_list_with_as_list_and_iterator_raises(gl):
253+
withpytest.raises(ValueError,match="`as_list` or `iterator`"):
254+
gl.gitlabciymls.list(as_list=False,iterator=True)

‎tests/unit/test_gitlab.py‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1818

1919
importcopy
20+
importlogging
2021
importpickle
2122
importwarnings
23+
fromhttp.clientimportHTTPConnection
2224

2325
importpytest
2426
importresponses
@@ -100,6 +102,14 @@ def test_gitlab_as_context_manager():
100102
assertisinstance(gl,gitlab.Gitlab)
101103

102104

105+
deftest_gitlab_enable_debug(gl):
106+
gl.enable_debug()
107+
108+
logger=logging.getLogger("requests.packages.urllib3")
109+
assertlogger.level==logging.DEBUG
110+
assertHTTPConnection.debuglevel==1
111+
112+
103113
@responses.activate
104114
@pytest.mark.parametrize(
105115
"status_code,response_json,expected",
@@ -143,6 +153,20 @@ def test_gitlab_get_license(gl, response_json, expected):
143153
assertgitlab_license==expected
144154

145155

156+
@responses.activate
157+
deftest_gitlab_set_license(gl):
158+
responses.add(
159+
method=responses.POST,
160+
url="http://localhost/api/v4/license",
161+
json={"id":1,"plan":"premium"},
162+
status=201,
163+
match=helpers.MATCH_EMPTY_QUERY_PARAMS,
164+
)
165+
166+
gitlab_license=gl.set_license("yJkYXRhIjoiMHM5Q")
167+
assertgitlab_license["plan"]=="premium"
168+
169+
146170
@responses.activate
147171
deftest_gitlab_build_list(gl,resp_page_1,resp_page_2):
148172
responses.add(**resp_page_1)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp