diff options
Diffstat (limited to 'tests/files')
-rw-r--r-- | tests/files/fail/test_enum.yaml | 6 | ||||
-rw-r--r-- | tests/files/fail/test_mapping.yaml | 2 | ||||
-rw-r--r-- | tests/files/fail/test_type_email.yaml | 10 | ||||
-rw-r--r-- | tests/files/fail/test_type_float.yaml | 2 | ||||
-rw-r--r-- | tests/files/fail/test_type_url.yaml | 11 | ||||
-rw-r--r-- | tests/files/success/test_mapping.yaml | 45 | ||||
-rw-r--r-- | tests/files/success/test_type_email.yaml | 8 | ||||
-rw-r--r-- | tests/files/success/test_type_url.yaml | 9 |
8 files changed, 85 insertions, 8 deletions
diff --git a/tests/files/fail/test_enum.yaml b/tests/files/fail/test_enum.yaml index 9f619dc..ba223e3 100644 --- a/tests/files/fail/test_enum.yaml +++ b/tests/files/fail/test_enum.yaml @@ -11,6 +11,6 @@ schema: - type: str enum: [E, F, G, H] errors: - - "Enum 'A' does not exist. Path: '/0'" - - "Enum 'B' does not exist. Path: '/1'" - - "Enum 'O' does not exist. Path: '/2'" + - "Enum 'A' does not exist. Path: '/0' Enum: ['E', 'F', 'G', 'H']" + - "Enum 'B' does not exist. Path: '/1' Enum: ['E', 'F', 'G', 'H']" + - "Enum 'O' does not exist. Path: '/2' Enum: ['E', 'F', 'G', 'H']" diff --git a/tests/files/fail/test_mapping.yaml b/tests/files/fail/test_mapping.yaml index 0561ea4..88b390f 100644 --- a/tests/files/fail/test_mapping.yaml +++ b/tests/files/fail/test_mapping.yaml @@ -158,7 +158,7 @@ data: birth: Jul 01, 1985 errors: - "Cannot find required key 'name'. Path: ''" - - "Enum 'ab' does not exist. Path: '/blood'" + - "Enum 'ab' does not exist. Path: '/blood' Enum: ['A', 'B', 'O', 'AB']" - "Key 'nam' was not defined. Path: ''" - "Value 'foo(at)mail.com' does not match pattern '.+@.+'. Path: '/email'" - "Value 'twenty' is not of type 'int'. Path: '/age'" diff --git a/tests/files/fail/test_type_email.yaml b/tests/files/fail/test_type_email.yaml new file mode 100644 index 0000000..9c8c18f --- /dev/null +++ b/tests/files/fail/test_type_email.yaml @@ -0,0 +1,10 @@ +--- +name: email-1 +desc: basic email type validation. Fails if not conforms with RFC 5322 Official Standard +# +schema: + type: email +data: + "foobar|gmail.com" +errors: + - "Value 'foobar|gmail.com' is not of type 'email'. Path: ''" diff --git a/tests/files/fail/test_type_float.yaml b/tests/files/fail/test_type_float.yaml index bef14b8..972167d 100644 --- a/tests/files/fail/test_type_float.yaml +++ b/tests/files/fail/test_type_float.yaml @@ -17,8 +17,6 @@ schema: seq: - type: float errors: - - "Value 'foo' is not of type 'float'. Path: '/0'" -errors: - "Value 'True' is not of type 'float'. Path: '/1'" - "Value 'foo' is not of type 'float'. Path: '/0'" --- diff --git a/tests/files/fail/test_type_url.yaml b/tests/files/fail/test_type_url.yaml new file mode 100644 index 0000000..1e79dfc --- /dev/null +++ b/tests/files/fail/test_type_url.yaml @@ -0,0 +1,11 @@ +--- +name: url2 +desc: basic url type validation. Fails as not confirms with RFC 1808 +# +schema: + type: url +# +data: + "www.google.com" +errors: + - "Value 'www.google.com' is not of type 'url'. Path: ''" diff --git a/tests/files/success/test_mapping.yaml b/tests/files/success/test_mapping.yaml index fb82fd6..66a08a7 100644 --- a/tests/files/success/test_mapping.yaml +++ b/tests/files/success/test_mapping.yaml @@ -219,7 +219,7 @@ data: schema: type: map mapping: - regex;/[A-Z]-/: + regex;([A-Z]-): type: map mapping: name: @@ -305,4 +305,45 @@ schema: type: map mapping: regex;(person[1-9]): - required: True
\ No newline at end of file + required: True +--- +name: mapping19 +desc: Test regex mapping with integer keys +data: + test: + 1: test + 2: test2 +schema: + type: map + mapping: + test: + type: map + mapping: + regex;(.+): + type: str +--- +name: mapping 20 +desc: Test mapping with integer keys +data: + test: + 0: test +schema: + type: map + mapping: + test: + type: map + mapping: + 0: + type: str +--- +name: mapping21 +desc: Test that 'required' integer regex keys are supported. +data: + 1234: Albert + 1235: Tom +schema: + type: map + mapping: + regex;([0-9]+): + required: True + type: str diff --git a/tests/files/success/test_type_email.yaml b/tests/files/success/test_type_email.yaml new file mode 100644 index 0000000..4dd4bee --- /dev/null +++ b/tests/files/success/test_type_email.yaml @@ -0,0 +1,8 @@ +--- +name: email-1 +desc: basic email type validation. Fails if not conforms with RFC 5322 Official Standard +# +schema: + type: email +data: + "foobar@gmail.com" diff --git a/tests/files/success/test_type_url.yaml b/tests/files/success/test_type_url.yaml new file mode 100644 index 0000000..28e369e --- /dev/null +++ b/tests/files/success/test_type_url.yaml @@ -0,0 +1,9 @@ +--- +name: url1 +desc: basic url type validation +# +schema: + type: url +# +data: + "http://www.google.com" |