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

Commit67942f0

Browse files
committed
test(projects): add unit tests for projects
1 parentca98d88 commit67942f0

File tree

3 files changed

+537
-100
lines changed

3 files changed

+537
-100
lines changed

‎tests/unit/conftest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ def project(gl):
6969
returngl.projects.get(1,lazy=True)
7070

7171

72+
@pytest.fixture
73+
defanother_project(gl):
74+
returngl.projects.get(2,lazy=True)
75+
76+
7277
@pytest.fixture
7378
defproject_issue(project):
7479
returnproject.issues.get(1,lazy=True)

‎tests/unit/objects/test_project_import_export.py

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,36 @@ def resp_import_github():
7373
yieldrsps
7474

7575

76+
@pytest.fixture
77+
defresp_import_bitbucket_server():
78+
content= {
79+
"id":1,
80+
"name":"project",
81+
"import_status":"scheduled",
82+
}
83+
84+
withresponses.RequestsMock()asrsps:
85+
rsps.add(
86+
method=responses.POST,
87+
url="http://localhost/api/v4/import/bitbucket_server",
88+
json=content,
89+
content_type="application/json",
90+
status=201,
91+
)
92+
yieldrsps
93+
94+
7695
deftest_import_project(gl,resp_import_project):
77-
project_import=gl.projects.import_project("file","api-project")
96+
project_import=gl.projects.import_project(
97+
"file","api-project","api-project","root"
98+
)
99+
assertproject_import["import_status"]=="scheduled"
100+
101+
102+
deftest_import_project_with_override_params(gl,resp_import_project):
103+
project_import=gl.projects.import_project(
104+
"file","api-project",override_params={"visibility":"private"}
105+
)
78106
assertproject_import["import_status"]=="scheduled"
79107

80108

@@ -94,6 +122,21 @@ def test_import_github(gl, resp_import_github):
94122
assertret["full_name"].endswith(name)
95123

96124

125+
deftest_import_bitbucket_server(gl,resp_import_bitbucket_server):
126+
res=gl.projects.import_bitbucket_server(
127+
bitbucket_server_project="project",
128+
bitbucket_server_repo="repo",
129+
bitbucket_server_url="url",
130+
bitbucket_server_username="username",
131+
personal_access_token="token",
132+
new_name="new_name",
133+
target_namespace="namespace",
134+
)
135+
assertres["id"]==1
136+
assertres["name"]=="project"
137+
assertres["import_status"]=="scheduled"
138+
139+
97140
deftest_create_project_export(project,resp_export):
98141
export=project.exports.create()
99142
assertexport.message=="202 Accepted"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp