adapting shipcall, times and user to include ValidationError (marshmallow). Adjusting the Schemas for User, Times and Shipcall to be validated with additional input validators. Creating a set of tests for the input validations.
This commit is contained in:
parent
6aaaa32445
commit
16c8bebfe0
8
brecal.code-workspace
Normal file
8
brecal.code-workspace
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
}
|
||||
@ -359,7 +359,7 @@ class TimesSchema(Schema):
|
||||
berth_info = fields.String(metadata={'required':False}, allow_none=True, validate=[validate.Length(max=256)])
|
||||
pier_side = fields.Bool(metadata={'required':False}, allow_none = True)
|
||||
shipcall_id = fields.Integer(metadata={'required':True})
|
||||
participant_type = fields.Enum(ParticipantType, metadata={'required':False}, allow_none=True, default=ParticipantType.undefined) #fields.Integer(metadata={'required':False}, allow_none=True)
|
||||
participant_type = fields.Integer(Required = False, allow_none=True)# TODO: could become Enum. fields.Enum(ParticipantType, metadata={'required':False}, allow_none=True, default=ParticipantType.undefined) #fields.Integer(metadata={'required':False}, allow_none=True)
|
||||
ata = fields.DateTime(metadata={'required':False}, allow_none=True)
|
||||
atd = fields.DateTime(metadata={'required':False}, allow_none=True)
|
||||
eta_interval_end = fields.DateTime(metadata={'required':False}, allow_none=True)
|
||||
@ -370,7 +370,6 @@ class TimesSchema(Schema):
|
||||
@validates("eta_berth")
|
||||
def validate_eta_berth(self, value):
|
||||
threshold_exceeded = validate_time_exceeds_threshold(value, months=12)
|
||||
print(threshold_exceeded, value)
|
||||
if threshold_exceeded:
|
||||
raise ValidationError(f"the provided time exceeds the twelve month threshold.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user