BEGIN;
    -- Load the TAP functions.
    CREATE EXTENSION pgtap;
    SET client_min_messages TO warning;

    -- Plan the tests.

    SELECT plan(25);

    -- Add data

    \i xt/data/42-pg/Base.sql

    -- Validate required tables

    SELECT has_table('defaults');
    SELECT has_table('entity_employee');
    SELECT has_table('session');
    SELECT has_table('user_preference');
    SELECT has_table('users');

    -- Validate required views

    SELECT has_view('user_listable');

    -- Validate required functions

    SELECT has_function('admin__add_user_to_role',ARRAY['text','text']);
    SELECT has_function('admin__delete_user',ARRAY['text','boolean']);
    SELECT has_function('admin__drop_session',ARRAY['integer']);
    SELECT has_function('admin__get_roles','{}'::text[]);
    SELECT has_function('admin__get_roles_for_user',ARRAY['integer']);
    SELECT has_function('admin__get_roles_for_user_by_entity',ARRAY['integer']);
    SELECT has_function('admin__get_user',ARRAY['integer']);
    SELECT has_function('admin__get_user_by_entity',ARRAY['integer']);
    SELECT has_function('admin__is_user',ARRAY['text']);
    SELECT has_function('admin__list_sessions','{}'::text[]);
    SELECT has_function('admin__remove_user_from_role',ARRAY['text','text']);
    SELECT has_function('admin__save_user',ARRAY['integer','integer','text','text','boolean']);
    SELECT has_function('admin__search_users',ARRAY['text','text','text','text','date']);
    SELECT has_function('user__change_password',ARRAY['text']);
    SELECT has_function('user__check_my_expiration','{}'::text[]);
    SELECT has_function('user__get_all_users','{}'::text[]);
    SELECT has_function('user__get_preferences',ARRAY['integer']);
    SELECT has_function('user__save_preferences',ARRAY['text','text','text','text','text']);

    -- Run tests

    SELECT ok(true,'No specific admin tests yet!');

    -- Finish the tests and clean up.
    SELECT * FROM finish();

ROLLBACK;
