Tests fully pass again

This commit is contained in:
Donkie
2024-05-23 20:13:51 +02:00
parent 535fa40ad2
commit c851950701
5 changed files with 14 additions and 6 deletions

View File

@@ -297,3 +297,9 @@ def assert_httpx_success(response: httpx.Response) -> None:
"""Assert that a response is successful."""
if not response.is_success:
pytest.fail(f"Request failed: {response.status_code} {response.text}")
def assert_httpx_code(response: httpx.Response, code: int) -> None:
"""Assert that a response has the expected status code."""
if response.status_code != code:
pytest.fail(f"Request failed: {response.status_code} {response.text}")

View File

@@ -4,7 +4,7 @@ import json
import httpx
from ..conftest import URL, assert_httpx_success
from ..conftest import URL, assert_httpx_code, assert_httpx_success
def test_add_vendor_with_extra_field():
@@ -56,8 +56,7 @@ def test_add_vendor_with_invalid_extra_field():
},
},
)
assert result.status_code == 400
assert "somefield" in result.json()["message"].lower()
assert_httpx_code(result, 422)
def test_add_vendor_with_extra_field_then_delete():

View File

@@ -82,7 +82,7 @@ def test_set_currency_wrong_type():
f"{URL}/api/v1/setting/currency",
json=123,
)
assert result.status_code == 400
assert result.status_code == 422
def test_set_big_value():