20 lines
761 B
Python
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
|