campingmontagut/test/schemas.sql
jordi fita mas 5d0861824a Add authentication relations, views, and functions for PostgreSQL
Most of them are exactly the same as we use for Numerus, but with the
main application schema changed to camper.

Closes #1
2023-07-22 01:59:12 +02:00

45 lines
1.5 KiB
PL/PgSQL

-- Test schemas
set client_min_messages to warning;
create extension if not exists pgtap;
reset client_min_messages;
begin;
select plan(21);
select schemas_are(array [
'auth',
'camper',
'public',
'sqitch'
]);
select schema_privs_are('auth', 'guest', array []::text[]);
select schema_privs_are('auth', 'employee', array []::text[]);
select schema_privs_are('auth', 'admin', array []::text[]);
select schema_privs_are('auth', 'authenticator', array []::text[]);
select schema_privs_are('auth', 'public', array []::text[]);
select schema_privs_are('camper', 'guest', array ['USAGE']);
select schema_privs_are('camper', 'employee', array ['USAGE']);
select schema_privs_are('camper', 'admin', array ['USAGE']);
select schema_privs_are('camper', 'authenticator', array []::text[]);
select schema_privs_are('camper', 'public', array []::text[]);
select schema_privs_are('public', 'guest', array ['USAGE']);
select schema_privs_are('public', 'employee', array ['USAGE']);
select schema_privs_are('public', 'admin', array ['USAGE']);
select schema_privs_are('public', 'authenticator', array ['USAGE']);
select schema_privs_are('public', 'public', array []::text[]);
select schema_privs_are('sqitch', 'guest', array []::text[]);
select schema_privs_are('sqitch', 'employee', array []::text[]);
select schema_privs_are('sqitch', 'admin', array []::text[]);
select schema_privs_are('sqitch', 'authenticator', array []::text[]);
select schema_privs_are('sqitch', 'public', array []::text[]);
select *
from finish();
rollback;