Mercurial > gemma
comparison schema/manage_users_tests.sql @ 232:4859aa6c96be
Add database function to delete role and user profile
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 26 Jul 2018 13:57:08 +0200 |
parents | 8b9cae6d3a21 |
children | 531d1f8a2b4b |
comparison
equal
deleted
inserted
replaced
231:694f959ba3e7 | 232:4859aa6c96be |
---|---|
167 $$, | 167 $$, |
168 $$ | 168 $$ |
169 SELECT rolpassword FROM pg_authid WHERE rolname = 'test_user_at' | 169 SELECT rolpassword FROM pg_authid WHERE rolname = 'test_user_at' |
170 $$, | 170 $$, |
171 'Giving a non-empty password string changes password'); | 171 'Giving a non-empty password string changes password'); |
172 | |
173 SET SESSION AUTHORIZATION test_sys_admin1; | |
174 | |
175 -- | |
176 -- Role deletion | |
177 -- | |
178 -- Note: backend termination is not tested in the following. | |
179 -- See also comments in function definition. | |
180 SELECT lives_ok($$ | |
181 SELECT sys_admin.create_user( | |
182 'waterway_user', 'test3', 'secret', 'AT', NULL, 'test3'); | |
183 SELECT sys_admin.delete_user('test3') | |
184 $$, | |
185 'Existing user can be deleted'); | |
186 | |
187 SELECT throws_ok($$ | |
188 SELECT sys_admin.delete_user('test_non_existent') | |
189 $$, | |
190 42704, NULL, | |
191 'Non-existent user cannot be deleted'); | |
192 | |
193 SELECT throws_ok($$ | |
194 SELECT sys_admin.delete_user(CAST(current_user AS varchar)) | |
195 $$, | |
196 55006, NULL, | |
197 'Current user cannot be deleted'); |