numerus/test/company_user.sql

40 lines
1.3 KiB
PL/PgSQL

-- Test company_user
set client_min_messages to warning;
create extension if not exists pgtap;
reset client_min_messages;
begin;
select plan(19);
set search_path to numerus, auth, public;
select has_table('company_user');
select has_pk('company_user' );
select col_is_pk('company_user', array['company_id', 'user_id']);
select table_privs_are('company_user', 'guest', array []::text[]);
select table_privs_are('company_user', 'invoicer', array ['SELECT']);
select table_privs_are('company_user', 'admin', array ['SELECT']);
select table_privs_are('company_user', 'authenticator', array []::text[]);
select has_column('company_user', 'company_id');
select col_is_fk('company_user', 'company_id');
select fk_ok('company_user', 'company_id', 'company', 'company_id');
select col_type_is('company_user', 'company_id', 'integer');
select col_not_null('company_user', 'company_id');
select col_hasnt_default('company_user', 'company_id');
select has_column('company_user', 'user_id');
select col_is_fk('company_user', 'user_id');
select fk_ok('company_user', 'user_id', 'user', 'user_id');
select col_type_is('company_user', 'user_id', 'integer');
select col_not_null('company_user', 'user_id');
select col_hasnt_default('company_user', 'user_id');
select *
from finish();
rollback;