numerus/test/quote_product_product.sql
jordi fita mas 35b12f7ea4 Add relations for sales quotations and their products
They are mostly the same as invoices, but the contact and payment method
are optional, thus, like other optionals fields, i created relations to
link these that have payment method or contact, to avoid NULL columns in
quote.

Still missing functions to add and edit quotations, and views to compute
their tax and total amount.
2023-06-06 21:08:31 +02:00

40 lines
1.5 KiB
PL/PgSQL

-- Test quote_product_product
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('quote_product_product');
select has_pk('quote_product_product' );
select table_privs_are('quote_product_product', 'guest', array []::text[]);
select table_privs_are('quote_product_product', 'invoicer', array ['SELECT', 'INSERT', 'UPDATE', 'DELETE']);
select table_privs_are('quote_product_product', 'admin', array ['SELECT', 'INSERT', 'UPDATE', 'DELETE']);
select table_privs_are('quote_product_product', 'authenticator', array []::text[]);
select has_column('quote_product_product', 'quote_product_id');
select col_is_pk('quote_product_product', 'quote_product_id');
select col_is_fk('quote_product_product', 'quote_product_id');
select fk_ok('quote_product_product', 'quote_product_id', 'quote_product', 'quote_product_id');
select col_type_is('quote_product_product', 'quote_product_id', 'integer');
select col_not_null('quote_product_product', 'quote_product_id');
select col_hasnt_default('quote_product_product', 'quote_product_id');
select has_column('quote_product_product', 'product_id');
select col_is_fk('quote_product_product', 'product_id');
select fk_ok('quote_product_product', 'product_id', 'product', 'product_id');
select col_type_is('quote_product_product', 'product_id', 'integer');
select col_not_null('quote_product_product', 'product_id');
select col_hasnt_default('quote_product_product', 'product_id');
select *
from finish();
rollback;