58 lines
1.9 KiB
MySQL
58 lines
1.9 KiB
MySQL
|
-- Test acsi
|
||
|
set client_min_messages to warning;
|
||
|
create extension if not exists pgtap;
|
||
|
reset client_min_messages;
|
||
|
|
||
|
begin;
|
||
|
|
||
|
select plan(33);
|
||
|
|
||
|
set search_path to camper, public;
|
||
|
|
||
|
select has_table('acsi');
|
||
|
select has_pk('acsi');
|
||
|
select table_privs_are('acsi', 'guest', array['SELECT']);
|
||
|
select table_privs_are('acsi', 'employee', array['SELECT']);
|
||
|
select table_privs_are('acsi', 'admin', array['SELECT', 'INSERT', 'UPDATE', 'DELETE']);
|
||
|
select table_privs_are('acsi', 'authenticator', array[]::text[]);
|
||
|
|
||
|
select has_column('acsi', 'campsite_type_id');
|
||
|
select col_is_pk('acsi', 'campsite_type_id');
|
||
|
select col_is_fk('acsi', 'campsite_type_id');
|
||
|
select fk_ok('acsi', 'campsite_type_id', 'campsite_type', 'campsite_type_id');
|
||
|
select col_type_is('acsi', 'campsite_type_id', 'integer');
|
||
|
select col_not_null('acsi', 'campsite_type_id');
|
||
|
select col_hasnt_default('acsi', 'campsite_type_id');
|
||
|
|
||
|
select has_column('acsi', 'number_adults');
|
||
|
select col_type_is('acsi', 'number_adults', 'positive_integer');
|
||
|
select col_not_null('acsi', 'number_adults');
|
||
|
select col_hasnt_default('acsi', 'number_adults');
|
||
|
|
||
|
select has_column('acsi', 'number_teenagers');
|
||
|
select col_type_is('acsi', 'number_teenagers', 'nonnegative_integer');
|
||
|
select col_not_null('acsi', 'number_teenagers');
|
||
|
select col_hasnt_default('acsi', 'number_teenagers');
|
||
|
|
||
|
select has_column('acsi', 'number_children');
|
||
|
select col_type_is('acsi', 'number_children', 'nonnegative_integer');
|
||
|
select col_not_null('acsi', 'number_children');
|
||
|
select col_hasnt_default('acsi', 'number_children');
|
||
|
|
||
|
select has_column('acsi', 'number_dogs');
|
||
|
select col_type_is('acsi', 'number_dogs', 'nonnegative_integer');
|
||
|
select col_not_null('acsi', 'number_dogs');
|
||
|
select col_hasnt_default('acsi', 'number_dogs');
|
||
|
|
||
|
select has_column('acsi', 'cost_per_night');
|
||
|
select col_type_is('acsi', 'cost_per_night', 'nonnegative_integer');
|
||
|
select col_not_null('acsi', 'cost_per_night');
|
||
|
select col_hasnt_default('acsi', 'cost_per_night');
|
||
|
|
||
|
|
||
|
select *
|
||
|
from finish();
|
||
|
|
||
|
rollback;
|
||
|
|