| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ca98d88 commit 67942f0
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -69,6 +69,11 @@ def project(gl): | |||
| 69 | 69 | return gl.projects.get(1, lazy=True) | |
| 70 | 70 | ||
| 71 | 71 | ||
| 72 | + @pytest.fixture | ||
| 73 | + def another_project(gl): | ||
| 74 | + return gl.projects.get(2, lazy=True) | ||
| 75 | + | ||
| 76 | + | ||
| 72 | 77 | @pytest.fixture | |
| 73 | 78 | def project_issue(project): | |
| 74 | 79 | return project.issues.get(1, lazy=True) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -73,8 +73,36 @@ def resp_import_github(): | |||
| 73 | 73 | yield rsps | |
| 74 | 74 | ||
| 75 | 75 | ||
| 76 | + @pytest.fixture | ||
| 77 | + def resp_import_bitbucket_server(): | ||
| 78 | + content = { | ||
| 79 | + "id": 1, | ||
| 80 | + "name": "project", | ||
| 81 | + "import_status": "scheduled", | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + with responses.RequestsMock() as rsps: | ||
| 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 | + yield rsps | ||
| 93 | + | ||
| 94 | + | ||
| 76 | 95 | def test_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 | + assert project_import["import_status"] == "scheduled" | ||
| 100 | + | ||
| 101 | + | ||
| 102 | + def test_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 | + ) | ||
| 78 | 106 | assert project_import["import_status"] == "scheduled" | |
| 79 | 107 | ||
| 80 | 108 | ||
@@ -94,6 +122,21 @@ def test_import_github(gl, resp_import_github): | |||
| 94 | 122 | assert ret["full_name"].endswith(name) | |
| 95 | 123 | ||
| 96 | 124 | ||
| 125 | + def test_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 | + assert res["id"] == 1 | ||
| 136 | + assert res["name"] == "project" | ||
| 137 | + assert res["import_status"] == "scheduled" | ||
| 138 | + | ||
| 139 | + | ||
| 97 | 140 | def test_create_project_export(project, resp_export): | |
| 98 | 141 | export = project.exports.create() | |
| 99 | 142 | assert export.message == "202 Accepted" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments