-- Test country
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, public;

select has_table('country');
select has_pk('country' );
select table_privs_are('country', 'guest', array []::text[]);
select table_privs_are('country', 'invoicer', array ['SELECT']);
select table_privs_are('country', 'admin', array ['SELECT']);
select table_privs_are('country', 'authenticator', array []::text[]);

select has_column('country', 'country_code');
select col_is_pk('country', 'country_code');
select col_type_is('country', 'country_code', 'country_code');
select col_not_null('country', 'country_code');
select col_hasnt_default('country', 'country_code');

select has_column('country', 'name');
select col_type_is('country', 'name', 'text');
select col_not_null('country', 'name');
select col_hasnt_default('country', 'name');

select has_column('country', 'postal_code_regex');
select col_type_is('country', 'postal_code_regex', 'text');
select col_not_null('country', 'postal_code_regex');
select col_hasnt_default('country', 'postal_code_regex');


select *
from finish();

rollback;

