summaryrefslogtreecommitdiff
path: root/tests/files/fail/test_type_str.yaml
diff options
context:
space:
mode:
authorJohan Fleury <jfleury@arcaik.net>2018-10-08 12:58:12 -0400
committerJohan Fleury <jfleury@arcaik.net>2018-10-08 12:58:12 -0400
commit735c78d3ecb695dd16cb37879880f522c4b29c72 (patch)
tree8bfb2ecbd0f03730efa1540cc65d8490b67e8ddd /tests/files/fail/test_type_str.yaml
Import upstream version 1.7.0
Diffstat (limited to 'tests/files/fail/test_type_str.yaml')
-rw-r--r--tests/files/fail/test_type_str.yaml73
1 files changed, 73 insertions, 0 deletions
diff --git a/tests/files/fail/test_type_str.yaml b/tests/files/fail/test_type_str.yaml
new file mode 100644
index 0000000..13cdbb6
--- /dev/null
+++ b/tests/files/fail/test_type_str.yaml
@@ -0,0 +1,73 @@
+---
+name: fail-type-str-1
+desc: Test simples str value
+data: 1
+schema:
+ type: str
+errors:
+ - "Value '1' is not of type 'str'. Path: ''"
+---
+name: fail-type-str-2
+desc: Test str value inside list
+data:
+ - 1
+ - True
+schema:
+ type: seq
+ sequence:
+ - type: str
+errors:
+ - "Value '1' is not of type 'str'. Path: '/0'"
+ - "Value 'True' is not of type 'str'. Path: '/1'"
+---
+name: fail-type-str-3
+desc: Test str value in mapping
+data:
+ foo: 1
+schema:
+ type: map
+ mapping:
+ foo:
+ type: str
+errors:
+ - "Value '1' is not of type 'str'. Path: '/foo'"
+---
+name: fail-type-str-4
+desc: Test str inside nested map & seq
+data:
+ foo:
+ - 1
+schema:
+ type: map
+ mapping:
+ foo:
+ type: seq
+ sequence:
+ - type: str
+errors:
+ - "Value '1' is not of type 'str'. Path: '/foo/0'"
+---
+name: fail-deftype-1
+desc: default type test
+schema:
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ "name":
+ "email":
+data:
+ - name: 123
+ email: true
+ - name: 3.14
+ - email: 2004-01-01
+errors:
+ - "Value '123' is not of type 'str'. Path: '/0/name'"
+ - "Value '2004-01-01' is not of type 'str'. Path: '/2/email'"
+ - "Value '3.14' is not of type 'str'. Path: '/1/name'"
+ - "Value 'True' is not of type 'str'. Path: '/0/email'"
+ ## Kwalify errors
+ # :type_unmatch : 1:3:[/0/name] '123': not a string.
+ # :type_unmatch : 2:3:[/0/email] 'true': not a string.
+ # :type_unmatch : 3:3:[/1/name] '3.14': not a string.
+ # :type_unmatch : 4:3:[/2/email] '2004-01-01': not a string.