Mercurial > gemma
view schema/manage_users_tests.sql @ 193:1585c334e8a7
More on persisting sessions.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 20 Jul 2018 18:32:11 +0200 |
parents | a9d9c2b1d08c |
children | 5dc8e734487a |
line wrap: on
line source
BEGIN; -- -- pgTAP test script for user management functions -- SELECT plan(5); -- Give number of tests that have to be run SET search_path TO public, gemma, gemma_waterway, gemma_fairway; -- -- Run tests as system_admin -- SET SESSION AUTHORIZATION sys_admin; SELECT lives_ok($$ SELECT create_user( 'waterway_user', 'test1', 'secret', 'AT', NULL, 'test1') $$, 'New waterway user can be added'); SELECT throws_ok($$ SELECT create_user( 'invalid', 'test2', 'secret', 'AT', NULL, 'test2') $$, 42704, NULL, 'Valid role name has to be provided'); SELECT throws_ok($$ SELECT create_user( 'waterway_user', NULL, 'secret', 'AT', NULL, 'test3') $$, 23502, NULL, 'username is mandatory'); -- Though other arguments are mandatory, too, there are no explicit tests SELECT throws_ok($$ SELECT create_user( 'waterway_user', 'waterway_user', 'secret', 'AT', NULL, 'test4') $$, 23505, NULL, 'No duplicate user name is allowed'); SELECT throws_ok($$ SELECT create_user( 'waterway_user', 'test2', 'secret', 'AT', NULL, 'xxx') $$, 23505, NULL, 'No duplicate e-mail adress is allowed'); -- -- finish tests -- SELECT * FROM finish(); -- Rollback because we don't want test roles to stay in the cluster, which -- would make tests not repeatable ROLLBACK;