-- 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',
	'numerus',
	'public',
	'sqitch'
]);

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

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

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

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

select *
from finish();

rollback;
