summaryrefslogtreecommitdiff
path: root/lib/query/tests/insert_list.t
blob: 3499bf8baae86a168b82882439bd2830f0d56611 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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"}