Skip to content

Commit

Permalink
ci: adds docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
jtyoung84 committed Jan 26, 2024
1 parent a8023f4 commit 4ced882
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions integration/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@


def _check_status_code(response, api_call: str, expected_status_code: int):
"""Helper function to test whether the status code is 200 or 204"""
if expected_status_code == 200 and response.status_code != 200:
raise AssertionError(
f"{api_call} failed!"
Expand All @@ -51,6 +52,7 @@ def _check_status_code(response, api_call: str, expected_status_code: int):


def test_search_data_asset(co_client: CodeOceanClient):
"""Tests the search_data_assets api call"""
response = co_client.search_data_assets(limit=10)
_check_status_code(
response=response,
Expand All @@ -61,6 +63,7 @@ def test_search_data_asset(co_client: CodeOceanClient):


def test_register_private_data_asset(co_client: CodeOceanClient):
"""Tests the create_data_asset api call with a private asset"""
utcnow_str = datetime.utcnow().strftime("%Y-%m-%d_%H-%M-%SZ")
asset_name = (
f"asset_generated_from_test_register_private_data_asset_{utcnow_str}"
Expand Down Expand Up @@ -92,6 +95,7 @@ def test_register_private_data_asset(co_client: CodeOceanClient):


def test_register_public_data_asset(co_client: CodeOceanClient):
"""Tests the create_data_asset api call with a public asset"""
utcnow_str = datetime.utcnow().strftime("%Y-%m-%d_%H-%M-%SZ")
asset_name = (
f"asset_generated_from_test_register_public_data_asset_{utcnow_str}"
Expand Down Expand Up @@ -125,6 +129,7 @@ def test_register_public_data_asset(co_client: CodeOceanClient):
def test_update_private_data_asset_permissions(
co_client: CodeOceanClient, data_asset_id
):
"""Tests the update_permissions api call in a private asset"""
response = co_client.update_permissions(
data_asset_id=data_asset_id, everyone="viewer"
)
Expand All @@ -139,6 +144,7 @@ def test_update_private_data_asset_permissions(
def test_update_public_data_asset_permissions(
co_client: CodeOceanClient, data_asset_id
):
"""Tests the update_permissions api call in a public asset"""
response = co_client.update_permissions(
data_asset_id=data_asset_id, everyone="viewer"
)
Expand All @@ -151,6 +157,7 @@ def test_update_public_data_asset_permissions(


def test_run_capsule(co_client: CodeOceanClient, data_asset_id, mount):
"""Tests the run_capsule api call"""
capsule_id = TEST_CAPSULE_ID
data_assets = [ComputationDataAsset(id=data_asset_id, mount=mount)]
run_capsule_request = RunCapsuleRequest(
Expand All @@ -164,6 +171,7 @@ def test_run_capsule(co_client: CodeOceanClient, data_asset_id, mount):


def run_tests():
"""Run all api call tests and print responses"""
co_client = CodeOceanClient(domain=DOMAIN, token=TOKEN)
search_data_asset_response = test_search_data_asset(co_client=co_client)
print(search_data_asset_response.json())
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ dev = [
'interrogate',
'isort',
'Sphinx',
'furo'
'furo',
'python-dotenv'
]

[tool.setuptools.packages.find]
Expand Down

0 comments on commit 4ced882

Please sign in to comment.