import datetime import pytest from marshmallow import ValidationError from ...app.coordinator.validators import validate_index, validate_datetime_greater_than_now def test_validate_index() -> None: assert validate_index(123456) is None def test_validate_index_with_invalid_value() -> None: with pytest.raises(ValidationError): validate_index(12345) with pytest.raises(ValidationError): validate_index(1234567) def test_validate_datetime_greater_than_now() -> None: d = datetime.datetime.now() + datetime.timedelta(days=2) assert validate_datetime_greater_than_now(d) is None def test_validate_datetime_greater_than_now_with_invalid_data() -> None: d = datetime.datetime.now() - datetime.timedelta(days=2) with pytest.raises(ValidationError): validate_datetime_greater_than_now(d)