-- Test marshal_payment
set client_min_messages to warning;
create extension if not exists pgtap;
reset client_min_messages;

begin;

select plan(9);

set search_path to camper, public;

select has_function('camper', 'marshal_payment', array['integer']);
select function_lang_is('camper', 'marshal_payment', array['integer'], 'sql');
select function_returns('camper', 'marshal_payment', array['integer'], 'jsonb');
select isnt_definer('camper', 'marshal_payment', array['integer']);
select volatility_is('camper', 'marshal_payment', array['integer'], 'volatile');
select function_privs_are('camper', 'marshal_payment', array ['integer'], 'guest', array['EXECUTE']);
select function_privs_are('camper', 'marshal_payment', array ['integer'], 'employee', array['EXECUTE']);
select function_privs_are('camper', 'marshal_payment', array ['integer'], 'admin', array['EXECUTE']);
select function_privs_are('camper', 'marshal_payment', array ['integer'], 'authenticator', array[]::text[]);

-- The function’s output is tested in unmarshal_booking’s test suite

select *
from finish();

rollback;
