Add test case for empty campsite_type’s name

This commit is contained in:
jordi fita mas 2023-08-08 19:52:27 +02:00
parent 6f6d251cf7
commit d6d2a9b843
1 changed files with 8 additions and 2 deletions

View File

@ -5,13 +5,13 @@ reset client_min_messages;
begin;
select plan(55);
select plan(56);
set search_path to camper, public;
select has_table('campsite_type');
select has_pk('campsite_type' );
select table_privs_are('campsite_type', 'guest', array['SELECT']::text[]);
select table_privs_are('campsite_type', 'guest', array['SELECT']);
select table_privs_are('campsite_type', 'employee', array['SELECT']);
select table_privs_are('campsite_type', 'admin', array['SELECT', 'INSERT', 'UPDATE', 'DELETE']);
select table_privs_are('campsite_type', 'authenticator', array[]::text[]);
@ -190,6 +190,12 @@ select bag_eq(
'No row should have been changed'
);
select throws_ok(
$$ insert into campsite_type (company_id, name) values (2, ' ' ) $$,
'23514', 'new row for relation "campsite_type" violates check constraint "name_not_empty"',
'Should not be able to insert campsite types with a blank name.'
);
reset role;