-- Test encrypt_password set client_min_messages to warning; create extension if not exists pgtap; reset client_min_messages; begin; select plan(11); set search_path to auth, tipus, public; select has_function('auth', 'encrypt_password', array []::name[]); select function_lang_is('auth', 'encrypt_password', array []::name[], 'plpgsql'); select function_returns('auth', 'encrypt_password', array []::name[], 'trigger'); select isnt_definer('auth', 'encrypt_password', array []::name[]); select volatility_is('auth', 'encrypt_password', array []::name[], 'volatile'); select function_privs_are('auth', 'encrypt_password', array []::name[], 'guest', array []::text[]); select function_privs_are('auth', 'encrypt_password', array []::name[], 'publisher', array []::text[]); select function_privs_are('auth', 'encrypt_password', array []::name[], 'admin', array []::text[]); select function_privs_are('auth', 'encrypt_password', array []::name[], 'authenticator', array []::text[]); select trigger_is('user', 'encrypt_password', 'encrypt_password'); set client_min_messages to warning; truncate "user" cascade; reset client_min_messages; insert into "user" (email, name, password, role) values ('info@tandem.blog', 'Perita', 'test', 'guest'); select row_eq( $$ select email from "user" where password = crypt('test', password) $$, row ('info@tandem.blog'::email), 'Should find the new user using its encrypted password' ); select * from finish(); rollback;