summaryrefslogtreecommitdiff
path: root/lib/configuration/tests/errors.t
diff options
context:
space:
mode:
Diffstat (limited to 'lib/configuration/tests/errors.t')
-rw-r--r--lib/configuration/tests/errors.t119
1 files changed, 119 insertions, 0 deletions
diff --git a/lib/configuration/tests/errors.t b/lib/configuration/tests/errors.t
new file mode 100644
index 0000000..6b5584e
--- /dev/null
+++ b/lib/configuration/tests/errors.t
@@ -0,0 +1,119 @@
+Differents invalid configuration. All of them shall report the error properly
+
+Every content shall have an identifier
+
+ $ tests -configuration <<EOF
+ > {
+ > "content": [
+ > {
+ > "key": "",
+ > }
+ > ]
+ > }
+ > EOF
+ in field "content":
+ while decoding a list:
+ element 0:
+ Expected an object with an attribute "id", but got { "key": "" }
+
+The content ID cannot be empty:
+
+ $ tests -configuration <<EOF
+ > {
+ > "content": [
+ > {
+ > "id": "",
+ > }
+ > ]
+ > }
+ > EOF
+ in field "content":
+ while decoding a list:
+ element 0: in field "id": Expected a non empty identifier, but got ""
+
+The content ID cannot be contains "." (this charater is used internaly):
+
+ $ tests -configuration <<EOF
+ > {
+ > "content": [
+ > {
+ > "id": "foo.bar",
+ > }
+ > ]
+ > }
+ > EOF
+ in field "content":
+ while decoding a list:
+ element 0:
+ in field "id":
+ Expected an identifier with only the accepted characters, but got
+ "foo.bar"
+
+A reference shall point to an existing content:
+
+ $ tests -configuration <<EOF
+ > {
+ > "content": [
+ > {
+ > "id": "content",
+ > "section": [
+ > {
+ > "field": [
+ > {
+ > "name": "name",
+ > "label": {},
+ > "type": {
+ > "content": "yes_no"
+ > }
+ > }
+ > ]
+ > }
+ > ]
+ > }
+ > ]
+ > }
+ > EOF
+ Undefined target "yes_no". Expected existing list or content, but got
+ { "content": "yes_no" }
+
+Cycles between required content are not accepted
+
+ $ tests -configuration <<EOF
+ > {
+ > "content": [
+ > {
+ > "id": "entity",
+ > "section": [
+ > {
+ > "field": [
+ > {
+ > "name": "user_type",
+ > "label": {},
+ > "required": true,
+ > "type": {
+ > "content": "user",
+ > "multivaluated": true,
+ > }
+ > }
+ > ]
+ > }
+ > ]
+ > },
+ > {
+ > "id": "user",
+ > "section": [
+ > {
+ > "field": [
+ > {
+ > "name": "entity",
+ > "label": {},
+ > "required": true,
+ > "type": { "content": "entity", }
+ > }
+ > ]
+ > }
+ > ]
+ > }
+ > ]
+ > }
+ Dependency circle found between: entity user