This repository has been archived on 2025-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
BreCal/src/server/tests/validators/test_validation_error.py

20 lines
761 B
Python

import pytest
def test_create_validation_error_response_is_serializable():
from BreCal.stubs.times_full import get_valid_stub_times
from BreCal.schemas import model
from BreCal.validators.validation_error import create_validation_error_response
content = get_valid_stub_times()
import datetime
content["operations_end"] = (datetime.datetime.now()-datetime.timedelta(minutes=14)).isoformat()
content["id"] = 3
try:
loadedModel = model.TimesSchema().load(data=content, many=False, partial=True)
except Exception as ex:
my_var = ex
create_validation_error_response(ex=ex, status_code=400) # this function initially created errors, as datetime objects were not serializable. Corrected now.
return