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

test(projects): add unit tests for projects#2069

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletionstests/unit/conftest.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -69,6 +69,11 @@ def project(gl):
return gl.projects.get(1, lazy=True)


@pytest.fixture
def another_project(gl):
return gl.projects.get(2, lazy=True)


@pytest.fixture
def project_issue(project):
return project.issues.get(1, lazy=True)
Expand Down
45 changes: 44 additions & 1 deletiontests/unit/objects/test_project_import_export.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -73,8 +73,36 @@ def resp_import_github():
yield rsps


@pytest.fixture
def resp_import_bitbucket_server():
content = {
"id": 1,
"name": "project",
"import_status": "scheduled",
}

with responses.RequestsMock() as rsps:
rsps.add(
method=responses.POST,
url="http://localhost/api/v4/import/bitbucket_server",
json=content,
content_type="application/json",
status=201,
)
yield rsps


def test_import_project(gl, resp_import_project):
project_import = gl.projects.import_project("file", "api-project")
project_import = gl.projects.import_project(
"file", "api-project", "api-project", "root"
)
assert project_import["import_status"] == "scheduled"


def test_import_project_with_override_params(gl, resp_import_project):
project_import = gl.projects.import_project(
"file", "api-project", override_params={"visibility": "private"}
)
assert project_import["import_status"] == "scheduled"


Expand All@@ -94,6 +122,21 @@ def test_import_github(gl, resp_import_github):
assert ret["full_name"].endswith(name)


def test_import_bitbucket_server(gl, resp_import_bitbucket_server):
res = gl.projects.import_bitbucket_server(
bitbucket_server_project="project",
bitbucket_server_repo="repo",
bitbucket_server_url="url",
bitbucket_server_username="username",
personal_access_token="token",
new_name="new_name",
target_namespace="namespace",
)
assert res["id"] == 1
assert res["name"] == "project"
assert res["import_status"] == "scheduled"


def test_create_project_export(project, resp_export):
export = project.exports.create()
assert export.message == "202 Accepted"
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp