camper/test/decode_base64url.sql

43 lines
1.5 KiB
MySQL
Raw Normal View History

-- Test decode_base64url
set client_min_messages to warning;
create extension if not exists pgtap;
reset client_min_messages;
begin;
select plan(13);
set search_path to camper, public;
select has_function('camper', 'decode_base64url', array['text']);
select function_lang_is('camper', 'decode_base64url', array['text'], 'sql');
select function_returns('camper', 'decode_base64url', array['text'], 'bytea');
select isnt_definer('camper', 'decode_base64url', array['text']);
select volatility_is('camper', 'decode_base64url', array['text'], 'immutable');
select function_privs_are('camper', 'decode_base64url', array ['text'], 'guest', array['EXECUTE']);
select function_privs_are('camper', 'decode_base64url', array ['text'], 'employee', array['EXECUTE']);
select function_privs_are('camper', 'decode_base64url', array ['text'], 'admin', array['EXECUTE']);
select function_privs_are('camper', 'decode_base64url', array ['text'], 'authenticator', array[]::text[]);
select is(
decode_base64url('sq7HjrUOBfKmC576ILgskD5srU870gJ7'),
decode('sq7HjrUOBfKmC576ILgskD5srU870gJ7', 'base64')
);
select is(
decode_base64url('K-gWWTl-gKlkxEGDsuc0UunIQwoFLM0t'),
decode('K+gWWTl+gKlkxEGDsuc0UunIQwoFLM0t', 'base64')
);
select is(
decode_base64url('cQGdqnb4V_nSKe8zTzyP_VaDGd2rAmzt'),
decode('cQGdqnb4V/nSKe8zTzyP/VaDGd2rAmzt', 'base64')
);
select is(
decode_base64url('x59e-kbXSpgsmy31V5l2BtTuKv8_pVKg'),
decode('x59e+kbXSpgsmy31V5l2BtTuKv8/pVKg', 'base64')
);
select *
from finish();
rollback;