82 lines
3.3 KiB
PL/PgSQL
82 lines
3.3 KiB
PL/PgSQL
-- Test payment_customer
|
|
set client_min_messages to warning;
|
|
create extension if not exists pgtap;
|
|
reset client_min_messages;
|
|
|
|
begin;
|
|
|
|
select plan(53);
|
|
|
|
set search_path to camper, public;
|
|
|
|
select has_table('payment_customer');
|
|
select has_pk('payment_customer');
|
|
select table_privs_are('payment_customer', 'guest', array['SELECT', 'INSERT', 'UPDATE']);
|
|
select table_privs_are('payment_customer', 'employee', array['SELECT', 'INSERT', 'UPDATE']);
|
|
select table_privs_are('payment_customer', 'admin', array['SELECT', 'INSERT', 'UPDATE', 'DELETE']);
|
|
select table_privs_are('payment_customer', 'authenticator', array[]::text[]);
|
|
|
|
select has_column('payment_customer', 'payment_id');
|
|
select col_is_pk('payment_customer', 'payment_id');
|
|
select col_is_fk('payment_customer', 'payment_id');
|
|
select fk_ok('payment_customer', 'payment_id', 'payment', 'payment_id');
|
|
select col_type_is('payment_customer', 'payment_id', 'integer');
|
|
select col_not_null('payment_customer', 'payment_id');
|
|
select col_hasnt_default('payment_customer', 'payment_id');
|
|
|
|
select has_column('payment_customer', 'full_name');
|
|
select col_type_is('payment_customer', 'full_name', 'text');
|
|
select col_not_null('payment_customer', 'full_name');
|
|
select col_hasnt_default('payment_customer', 'full_name');
|
|
|
|
select has_column('payment_customer', 'address');
|
|
select col_type_is('payment_customer', 'address', 'text');
|
|
select col_not_null('payment_customer', 'address');
|
|
select col_hasnt_default('payment_customer', 'address');
|
|
|
|
select has_column('payment_customer', 'postal_code');
|
|
select col_type_is('payment_customer', 'postal_code', 'text');
|
|
select col_not_null('payment_customer', 'postal_code');
|
|
select col_hasnt_default('payment_customer', 'postal_code');
|
|
|
|
select has_column('payment_customer', 'city');
|
|
select col_type_is('payment_customer', 'city', 'text');
|
|
select col_not_null('payment_customer', 'city');
|
|
select col_hasnt_default('payment_customer', 'city');
|
|
|
|
select has_column('payment_customer', 'country_code');
|
|
select col_is_fk('payment_customer', 'country_code');
|
|
select fk_ok('payment_customer', 'country_code', 'country', 'country_code');
|
|
select col_type_is('payment_customer', 'country_code', 'country_code');
|
|
select col_not_null('payment_customer', 'country_code');
|
|
select col_hasnt_default('payment_customer', 'country_code');
|
|
|
|
select has_column('payment_customer', 'email');
|
|
select col_type_is('payment_customer', 'email', 'email');
|
|
select col_not_null('payment_customer', 'email');
|
|
select col_hasnt_default('payment_customer', 'email');
|
|
|
|
select has_column('payment_customer', 'phone');
|
|
select col_type_is('payment_customer', 'phone', 'packed_phone_number');
|
|
select col_not_null('payment_customer', 'phone');
|
|
select col_hasnt_default('payment_customer', 'phone');
|
|
|
|
select has_column('payment_customer', 'acsi_card');
|
|
select col_type_is('payment_customer', 'acsi_card', 'boolean');
|
|
select col_not_null('payment_customer', 'acsi_card');
|
|
select col_hasnt_default('payment_customer', 'acsi_card');
|
|
|
|
select has_column('payment_customer', 'lang_tag');
|
|
select col_is_fk('payment_customer', 'lang_tag');
|
|
select fk_ok('payment_customer', 'lang_tag', 'language', 'lang_tag');
|
|
select col_type_is('payment_customer', 'lang_tag', 'text');
|
|
select col_not_null('payment_customer', 'lang_tag');
|
|
select col_hasnt_default('payment_customer', 'lang_tag');
|
|
|
|
|
|
select *
|
|
from finish();
|
|
|
|
rollback;
|
|
|