-- Test schemas
set client_min_messages to warning;
create extension if not exists pgtap;
reset client_min_messages;

begin;

select plan(17);

select schemas_are(array [
    'auth',
    'tipus',
    'public',
    'sqitch'
    ]);

select schema_privs_are('auth', 'guest', array []::text[]);
select schema_privs_are('auth', 'publisher', array []::text[]);
select schema_privs_are('auth', 'admin', array []::text[]);
select schema_privs_are('auth', 'authenticator', array []::text[]);

select schema_privs_are('tipus', 'guest', array ['USAGE']);
select schema_privs_are('tipus', 'publisher', array ['USAGE']);
select schema_privs_are('tipus', 'admin', array ['USAGE']);
select schema_privs_are('tipus', 'authenticator', array []::text[]);

select schema_privs_are('public', 'guest', array ['USAGE']);
select schema_privs_are('public', 'publisher', array ['USAGE']);
select schema_privs_are('public', 'admin', array ['USAGE']);
select schema_privs_are('public', 'authenticator', array ['USAGE']);

select schema_privs_are('sqitch', 'guest', array []::text[]);
select schema_privs_are('sqitch', 'publisher', array []::text[]);
select schema_privs_are('sqitch', 'admin', array []::text[]);
select schema_privs_are('sqitch', 'authenticator', array []::text[]);

select *
from finish();

rollback;
