summaryrefslogtreecommitdiff
path: root/lib/query/tests
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2026-11-19 11:57:17 +0100
committerSébastien Dailly <sebastien@dailly.me>2026-11-19 11:57:17 +0100
commitd1047791e9e25bc5a30ffc62f31c3d898843f042 (patch)
tree724936abe391c80630c36ec464aee386ff1782aa /lib/query/tests
parent8708171877054c98aad45079d85d4e699420f2fe (diff)
Insert list data
Diffstat (limited to 'lib/query/tests')
-rw-r--r--lib/query/tests/insert_list.t45
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/query/tests/insert_list.t b/lib/query/tests/insert_list.t
new file mode 100644
index 0000000..3499bf8
--- /dev/null
+++ b/lib/query/tests/insert_list.t
@@ -0,0 +1,45 @@
+Insert rows in the lists declared in the configuration, then display the list
+tables. Two rows are inserted per list; text and integer fields get a value
+derived from the field name, and references point to the row of id 1:
+
+ $ tests --insert_list <<EOF
+ > {
+ > "list": [
+ > {
+ > "id": "country_list",
+ > "field": [
+ > { "name": "name", "label": {}, "type": "text" },
+ > { "name": "code", "label": {}, "type": "text" }
+ > ]
+ > },
+ > {
+ > "id": "user_type_list",
+ > "field": [
+ > { "name": "label", "label": {}, "type": "text" },
+ > { "name": "rank", "label": {}, "type": "integer" },
+ > {
+ > "name": "country",
+ > "label": {},
+ > "type": { "content": "country_list" }
+ > },
+ > {
+ > "name": "aliases",
+ > "label": {},
+ > "type": { "content": "country_list", "multivaluated": true }
+ > }
+ > ]
+ > }
+ > ],
+ > "content": [ { "id": "entity" } ]
+ > }
+ > EOF
+ country_list:
+ {"id":1,"name":"name-1","code":"code-1"}
+ {"id":2,"name":"name-2","code":"code-2"}
+ user_type_list:
+ {"id":1,"label":"label-1","rank":1,"country":1,"country_table":"country_list"}
+ {"id":2,"label":"label-2","rank":2,"country":1,"country_table":"country_list"}
+ user_type_list.aliases:
+ {"parent":1,"target":1,"target_table":"country_list"}
+ {"parent":1,"target":2,"target_table":"country_list"}
+ {"parent":2,"target":2,"target_table":"country_list"}