mirror of
https://github.com/correl/openapi-core.git
synced 2025-01-01 11:03:19 +00:00
Merge pull request #132 from niteoweb/fix/password_format
Add support for `password` string format
This commit is contained in:
commit
391d664dac
2 changed files with 9 additions and 0 deletions
|
@ -42,6 +42,7 @@ class Schema(object):
|
|||
|
||||
STRING_FORMAT_CALLABLE_GETTER = {
|
||||
SchemaFormat.NONE: Format(text_type, TypeValidator(text_type)),
|
||||
SchemaFormat.PASSWORD: Format(text_type, TypeValidator(text_type)),
|
||||
SchemaFormat.DATE: Format(
|
||||
format_date, TypeValidator(date, exclude=datetime)),
|
||||
SchemaFormat.DATETIME: Format(format_datetime, TypeValidator(datetime)),
|
||||
|
|
|
@ -66,6 +66,14 @@ class TestSchemaUnmarshal(object):
|
|||
|
||||
assert result == value
|
||||
|
||||
def test_string_format_password(self):
|
||||
schema = Schema(SchemaType.STRING, schema_format=SchemaFormat.PASSWORD)
|
||||
value = 'password'
|
||||
|
||||
result = schema.unmarshal(value)
|
||||
|
||||
assert result == 'password'
|
||||
|
||||
def test_string_float_invalid(self):
|
||||
schema = Schema('string')
|
||||
value = 1.23
|
||||
|
|
Loading…
Reference in a new issue