Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Commit

Permalink
add pytest case
Browse files Browse the repository at this point in the history
  • Loading branch information
shijl0925 committed Aug 4, 2024
1 parent ff4f102 commit 3719e34
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/test_project_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,23 @@ def test_search_projects(sonar_client):
projects = [item["key"] for item in resp.get("components", [])]

assert len(projects) >= 0

def test_create_project(sonar_client):
organization = "williamsedmond90"
name = "sonar-java"
project_key = f"{organization}_sonar_java"
visibility = "public"
mainBranch = "master"

resp = sonar_client.projects.search_projects(projects=project_key, organization=organization)
components = resp.get("components", [])
if components:
return

sonar_client.projects.create_project(
project=project_key,
name=name,
organization=organization,
visibility=visibility,
mainBranch=mainBranch
)

0 comments on commit 3719e34

Please sign in to comment.