LP#1643709 User merge + purge pgtap test
authorRogan Hamby <rogan.hamby@gmail.com>
Fri, 14 Sep 2018 13:25:57 +0000 (09:25 -0400)
committerBen Shum <ben@evergreener.net>
Tue, 20 Nov 2018 01:35:09 +0000 (20:35 -0500)
Signed-off-by: Rogan Hamby <rogan.hamby@gmail.com>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Ben Shum <ben@evergreener.net>
Open-ILS/src/sql/Pg/t/lp1643709_purge_usrs_on_merge.pg [new file with mode: 0644]

diff --git a/Open-ILS/src/sql/Pg/t/lp1643709_purge_usrs_on_merge.pg b/Open-ILS/src/sql/Pg/t/lp1643709_purge_usrs_on_merge.pg
new file mode 100644 (file)
index 0000000..a74e9d1
--- /dev/null
@@ -0,0 +1,25 @@
+BEGIN;
+SELECT * FROM actor.usr_merge(58,4,TRUE,TRUE,TRUE);
+SELECT plan(3);
+SELECT is(
+    (SELECT id FROM actor.usr WHERE family_name ~* 'PURGED' AND id = 58)::INTEGER,
+    58::INTEGER,
+    'actor.usr values updated by usr delete/obliterate'
+);
+SELECT is_empty(
+    'SELECT id FROM actor.usr_address WHERE usr = 58',
+    'actor.usr_address entry is correctly deleted'
+);
+SELECT is_empty(
+    'SELECT id FROM actor.card WHERE usr = 58',
+    'actor.card entry is correctly deleted'
+);
+-- Finish the tests and clean up.
+SELECT * FROM finish();
+ROLLBACK;