Skip to content

Commit

Permalink
tests: use content instead of data for http requests
Browse files Browse the repository at this point in the history
Signed-off-by: Kamoltat Sirivadhna <[email protected]>
  • Loading branch information
kamoltat committed Nov 13, 2024
1 parent 4660f3c commit a1d7d10
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest
from teuthology_api.main import app
from unittest.mock import patch
from teuthology_api.services.helpers import Request, get_token, get_username
from teuthology_api.services.helpers import get_token, get_username

client = TestClient(app)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_kill.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ def test_kill_run_success(m_get_username, m_get_run_details, m_popen):
mock_process = m_popen.return_value
mock_process.communicate.return_value = ("logs", "")
mock_process.wait.return_value = 0
response = client.post("/kill", data=json.dumps(mock_kill_args))
response = client.post("/kill", content=json.dumps(mock_kill_args))
assert response.status_code == 200
assert response.json() == {"kill": "success"}


def test_kill_run_fail():
response = client.post("/kill", data=json.dumps(mock_kill_args))
response = client.post("/kill", content=json.dumps(mock_kill_args))
assert response.status_code == 401
assert response.json() == {"detail": "You need to be logged in"}
2 changes: 1 addition & 1 deletion tests/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async def override_get_token():
def test_suite_run_success(m_get_run_details, m_get_username, m_logs_run):
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))
response = client.post("/suite", content=json.dumps(mock_suite_args))
assert response.status_code == 200
assert response.json() == {"run": {"id": "7451978", "user": "user1"}}

Expand Down

0 comments on commit a1d7d10

Please sign in to comment.