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

Commitb8ea96c

Browse files
committed
chore: flatten test_import_github
1 parenta881fb7 commitb8ea96c

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

‎gitlab/tests/objects/test_projects.py

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,24 @@ def resp_import_status(url, request):
252252
returnresponse(200,content,headers,None,25,request)
253253

254254

255+
@urlmatch(
256+
scheme="http",
257+
netloc="localhost",
258+
path="/api/v4/import/github",
259+
method="post",
260+
)
261+
defresp_import_github(url,request):
262+
headers= {"content-type":"application/json"}
263+
content="""{
264+
"id": 27,
265+
"name": "my-repo",
266+
"full_path": "/root/my-repo",
267+
"full_name": "Administrator / my-repo"
268+
}"""
269+
content=content.encode("utf-8")
270+
returnresponse(200,content,headers,None,25,request)
271+
272+
255273
classTestProjectImport(TestProject):
256274
@with_httmock(resp_import_project)
257275
deftest_import_project(self):
@@ -264,29 +282,12 @@ def test_refresh_project_import_status(self):
264282
project_import.refresh()
265283
self.assertEqual(project_import.import_status,"finished")
266284

285+
@with_httmock(resp_import_github)
267286
deftest_import_github(self):
268-
@urlmatch(
269-
scheme="http",
270-
netloc="localhost",
271-
path="/api/v4/import/github",
272-
method="post",
273-
)
274-
defresp_import_github(url,request):
275-
headers= {"content-type":"application/json"}
276-
content="""{
277-
"id": 27,
278-
"name": "my-repo",
279-
"full_path": "/root/my-repo",
280-
"full_name": "Administrator / my-repo"
281-
}"""
282-
content=content.encode("utf-8")
283-
returnresponse(200,content,headers,None,25,request)
284-
285-
withHTTMock(resp_import_github):
286-
base_path="/root"
287-
name="my-repo"
288-
ret=self.gl.projects.import_github("githubkey",1234,base_path,name)
289-
self.assertIsInstance(ret,dict)
290-
self.assertEqual(ret["name"],name)
291-
self.assertEqual(ret["full_path"],"/".join((base_path,name)))
292-
self.assertTrue(ret["full_name"].endswith(name))
287+
base_path="/root"
288+
name="my-repo"
289+
ret=self.gl.projects.import_github("githubkey",1234,base_path,name)
290+
self.assertIsInstance(ret,dict)
291+
self.assertEqual(ret["name"],name)
292+
self.assertEqual(ret["full_path"],"/".join((base_path,name)))
293+
self.assertTrue(ret["full_name"].endswith(name))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp