From 8df1c86a7822ad3b2f74b713d74f132eaa3686c0 Mon Sep 17 00:00:00 2001 From: Kamoltat Sirivadhna Date: Fri, 10 May 2024 15:52:49 -0400 Subject: [PATCH] tests/test_suite.py modify test_suite_run_success Added job counts to unittest. Signed-off-by: Kamoltat Sirivadhna --- tests/test_suite.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_suite.py b/tests/test_suite.py index ab2f6f7..6f6841f 100644 --- a/tests/test_suite.py +++ b/tests/test_suite.py @@ -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) @@ -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