camper/test/acsi_calendar.sql

38 lines
1.3 KiB
PL/PgSQL

-- Test acsi_calendar
set client_min_messages to warning;
create extension if not exists pgtap;
reset client_min_messages;
begin;
select plan(17);
set search_path to camper, public;
select has_table('acsi_calendar');
select has_pk('acsi_calendar');
select col_is_pk('acsi_calendar', array['campsite_type_id', 'acsi_range']);
select table_privs_are('acsi_calendar', 'guest', array['SELECT']);
select table_privs_are('acsi_calendar', 'employee', array['SELECT']);
select table_privs_are('acsi_calendar', 'admin', array['SELECT', 'INSERT', 'UPDATE', 'DELETE']);
select table_privs_are('acsi_calendar', 'authenticator', array[]::text[]);
select has_column('acsi_calendar', 'campsite_type_id');
select col_is_fk('acsi_calendar', 'campsite_type_id');
select fk_ok('acsi_calendar', 'campsite_type_id', 'acsi', 'campsite_type_id');
select col_type_is('acsi_calendar', 'campsite_type_id', 'integer');
select col_not_null('acsi_calendar', 'campsite_type_id');
select col_hasnt_default('acsi_calendar', 'campsite_type_id');
select has_column('acsi_calendar', 'acsi_range');
select col_type_is('acsi_calendar', 'acsi_range', 'daterange');
select col_not_null('acsi_calendar', 'acsi_range');
select col_hasnt_default('acsi_calendar', 'acsi_range');
select *
from finish();
rollback;