campingmontagut/test/acsi_calendar.sql
jordi fita mas 0412ffca05 Compute ACSI discount
After months of keeping what does the ACSI checkbox mean, now customer
told us that we should add a discount based on a series of
arbitrary conditions that, and need to be done NOW!

There is no UI to edit the conditions due to lack of time.
2024-03-14 22:08:01 +01:00

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;