Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DNM] tests: use content instead of data for http requests #71

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading