]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/sql/Pg/live_t/aous_batch.pg
LP2061136 - Stamping 1405 DB upgrade script
[working/Evergreen.git] / Open-ILS / src / sql / Pg / live_t / aous_batch.pg
1 BEGIN;
2
3 SELECT plan(3);
4
5 INSERT INTO config.org_unit_setting_type (name, label) VALUES ('foo', 'Turn on foo');
6 INSERT INTO config.org_unit_setting_type (name, label) VALUES ('bar', 'Turn on bar');
7
8 INSERT INTO actor.org_unit_setting (org_unit, name, value) VALUES (1, 'foo', '"foo 1"');
9 INSERT INTO actor.org_unit_setting (org_unit, name, value) VALUES (2, 'foo', '"foo 2"');
10 INSERT INTO actor.org_unit_setting (org_unit, name, value) VALUES (2, 'bar', '"bar 2"');
11
12 SELECT results_eq(
13     $$ SELECT name, value FROM actor.org_unit_ancestor_setting_batch(1, '{foo,bar}') $$,
14     $$ VALUES ('foo', '"foo 1"') $$,
15     'can retrieve batch of org unit settings'
16 );
17
18 SELECT results_eq(
19     $$ SELECT name, value FROM actor.org_unit_ancestor_setting_batch(2, '{foo,bar}') $$,
20     $$ VALUES ('foo', '"foo 2"'), ('bar', '"bar 2"') $$,
21     'can retrieve batch of org unit settings at lower level'
22 );
23
24 DELETE FROM actor.org_unit_setting WHERE name = 'foo' AND org_unit = 2;
25 SELECT results_eq(
26     $$ SELECT name, value FROM actor.org_unit_ancestor_setting_batch(2, '{foo,bar}') $$,
27     $$ VALUES ('foo', '"foo 1"'), ('bar', '"bar 2"') $$,
28     'can retrieve batch of org unit settings with fallback'
29 );
30
31 ROLLBACK;