Initial commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import pytest
|
||||
from fastapi import HTTPException
|
||||
|
||||
from app.validation import parse_positive_int_ids
|
||||
|
||||
|
||||
def test_parse_alert_ids_accepts_positive_ints_and_decimal_strings():
|
||||
assert parse_positive_int_ids([1, "2"]) == [1, 2]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("value", [["abc"], [0], [-1], [True], "1"])
|
||||
def test_parse_alert_ids_rejects_malformed_values(value):
|
||||
with pytest.raises(HTTPException) as exc:
|
||||
parse_positive_int_ids(value)
|
||||
|
||||
assert exc.value.status_code == 400
|
||||
Reference in New Issue
Block a user