Skip to content

Commit

Permalink
add github/gitee CI
Browse files Browse the repository at this point in the history
  • Loading branch information
wumingzhilian committed Apr 9, 2024
1 parent 8c2b547 commit fe8a4c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def guest_dojo_admin():

@pytest.fixture(scope="session")
def example_dojo(admin_session):
rid = create_dojo("HUSTSeclab/example-dojo", session=admin_session)
rid = create_dojo("github","HUSTSeclab/example-dojo", session=admin_session)
make_dojo_official(rid, admin_session)
return rid

Expand All @@ -52,7 +52,7 @@ def belt_dojos(admin_session):

@pytest.fixture(scope="session")
def example_import_dojo(admin_session):
rid = create_dojo("pwncollege/example-import-dojo", session=admin_session)
rid = create_dojo("github","pwncollege/example-import-dojo", session=admin_session)
make_dojo_official(rid, admin_session)
return rid

Expand Down Expand Up @@ -81,7 +81,7 @@ def lfs_dojo(admin_session):
@pytest.fixture(scope="session")
def welcome_dojo(admin_session):
try:
rid = create_dojo("HUSTSeclab/welcome-dojo", session=admin_session)
rid = create_dojo("github","HUSTSeclab/welcome-dojo", session=admin_session)
except AssertionError:
rid = "welcome"
make_dojo_official(rid, admin_session)
Expand Down
4 changes: 2 additions & 2 deletions test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ def make_dojo_official(dojo_rid, admin_session):
response = admin_session.post(f"{PROTO}://{HOST}/pwncollege_api/v1/dojo/{dojo_rid}/promote-dojo", json={})
assert response.status_code == 200, f"Expected status code 200, but got {response.status_code} - {response.json()}"

def create_dojo(repository, *, session):
def create_dojo(repository_type,repository, *, session):
test_public_key = f"public/{repository}"
test_private_key = f"private/{repository}"
create_dojo_json = { "repository": repository, "repository_type":"github" , "public_key": test_public_key, "private_key": test_private_key }
create_dojo_json = { "repository_type":repository_type,"repository": repository, "public_key": test_public_key, "private_key": test_private_key }
response = session.post(f"{PROTO}://{HOST}/pwncollege_api/v1/dojo/create", json=create_dojo_json)
assert response.status_code == 200, f"Expected status code 200, but got {response.status_code} - {response.json()}"
dojo_reference_id = response.json()["dojo"]
Expand Down

0 comments on commit fe8a4c2

Please sign in to comment.