-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[@adrilene/@denisousa] Issue #73 - Testes de validação.
- Loading branch information
Showing
5 changed files
with
77 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
from marshmallow import ValidationError | ||
|
||
|
||
class SchemaBase(): | ||
class SchemaBase: | ||
def validate_post(self, body): | ||
if '_id' in body: | ||
return False, 'Id must not be sent' | ||
if "_id" in body: | ||
return False, "Id must not be sent" | ||
|
||
if 'updated_at' in body: | ||
return False, 'Updated must not be sent' | ||
if "updated_at" in body: | ||
return False, "Updated must not be sent" | ||
|
||
if 'deleted_at' in body: | ||
return False, 'Deleted must not be sent' | ||
if "deleted_at" in body: | ||
return False, "Deleted must not be sent" | ||
|
||
try: | ||
self.load(body) | ||
except ValidationError as err: | ||
return False, err.messages | ||
|
||
return True, 'OK' | ||
return True, "OK" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
mock_service_orders = { | ||
'service_order_with_id': { | ||
'_id': '123' | ||
'_id': 'xxxxx' | ||
}, | ||
'service_order_with_updated': { | ||
'updated_at': 'xxxxx' | ||
}, | ||
'service_order_with_deleted': { | ||
'deleted_at': 'xxxxx' | ||
} | ||
} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters