Skip to content

Commit

Permalink
tests/test_suite.py modify test_suite_run_success
Browse files Browse the repository at this point in the history
Added job counts to unittest.

Signed-off-by: Kamoltat Sirivadhna <[email protected]>
  • Loading branch information
kamoltat committed Jun 17, 2024
1 parent 651c469 commit 8df1c86
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from teuthology_api.main import app
from unittest.mock import patch
from teuthology_api.services.helpers import get_token
from teuthology_api.services.suite import make_run_name, get_run_details
from teuthology_api.services.suite import make_run_name
import json

client = TestClient(app)
Expand All @@ -29,15 +29,18 @@ async def override_get_token():
}

# suite


@patch("teuthology_api.services.suite.logs_run")
@patch("teuthology_api.routes.suite.get_username")
@patch("teuthology_api.services.suite.get_run_details")
def test_suite_run_success(m_get_run_details, m_get_username, m_logs_run):
m_logs_run.return_value = ("success", "example logs", 1)
m_get_username.return_value = "user1"
m_get_run_details.return_value = {"id": "7451978", "user": "user1"}
response = client.post("/suite", data=json.dumps(mock_suite_args))
assert response.status_code == 200
assert response.json() == {"run": {"id": "7451978", "user": "user1"}}
assert response.json() == {"run": {"id": "7451978", "user": "user1"}, "job_count": 1}


# make_run_name
Expand Down

0 comments on commit 8df1c86

Please sign in to comment.