SQL privileges fix and unit tests

* Fixed privileges on both variants of defs.uoc_natural_resource()

* Added user unit tests which check execution privileges on all (new)
stored procedures and INSERT/UPDATE/SELECT/DELETE privileges on all
(new) tables
This commit is contained in:
Emmanuel BENOîT 2012-01-03 09:35:57 +01:00
parent d4945d8e21
commit e7d2072813
19 changed files with 258 additions and 2 deletions

View file

@ -0,0 +1,14 @@
/*
* Test privileges on defs.uoc_resource_internal()
*/
BEGIN;
SELECT plan( 1 );
SELECT diag_test_name( 'defs.uoc_resource_internal() - Privileges' );
PREPARE _test_this AS
SELECT defs.uoc_resource_internal( 'test1' , 'test2' , NULL , 1 );
SELECT throws_ok( '_test_this' , 42501 );
SELECT * FROM finish( );
ROLLBACK;

View file

@ -0,0 +1,14 @@
/*
* Test privileges on defs.uoc_resource()
*/
BEGIN;
SELECT plan( 2 );
SELECT diag_test_name( 'defs.uoc_resource() - Privileges (without category)' );
SELECT is( defs.uoc_resource( 'test1' , 'test2' , 1 ) , 'BAD_STRINGS' );
SELECT diag_test_name( 'defs.uoc_resource() - Privileges (with category)' );
SELECT is( defs.uoc_resource( 'test1' , 'test2' , 'test3' , 1 ) , 'BAD_STRINGS' );
SELECT * FROM finish( );
ROLLBACK;

View file

@ -0,0 +1,16 @@
/*
* Test privileges on defs.uoc_natres_internal()
*/
BEGIN;
SELECT plan( 1 );
SELECT diag_test_name( 'defs.uoc_natres_internal() - Privileges' );
PREPARE _test_this AS
SELECT defs.uoc_natres_internal( 'test1' , 'test2' , NULL , 1 ,
0.5 , 100 , 50 , 0.5 , 0.1 , 0.5 , 0.1
);
SELECT throws_ok( '_test_this' , 42501 );
SELECT * FROM finish( );
ROLLBACK;

View file

@ -0,0 +1,18 @@
/*
* Test privileges on defs.uoc_natural_resource()
*/
BEGIN;
SELECT plan( 2 );
SELECT diag_test_name( 'defs.uoc_natural_resource() - Privileges (without category)' );
SELECT is( defs.uoc_natural_resource( 'test1' , 'test2' , 1 ,
0.5 , 100 , 50 , 0.5 , 0.1 , 0.5 , 0.1
) , 'BAD_STRINGS' );
SELECT diag_test_name( 'defs.uoc_natural_resource() - Privileges (with category)' );
SELECT is( defs.uoc_natural_resource( 'test1' , 'test2' , 'test3' , 1 ,
0.5 , 100 , 50 , 0.5 , 0.1 , 0.5 , 0.1
) , 'BAD_STRINGS' );
SELECT * FROM finish( );
ROLLBACK;

View file

@ -0,0 +1,11 @@
/*
* Test privileges on verse.compute_provider_regeneration()
*/
BEGIN;
SELECT plan( 1 );
SELECT diag_test_name( 'verse.compute_provider_regeneration() - Privileges' );
SELECT throws_ok( 'SELECT verse.compute_provider_regeneration( 100.0 , 100.0 , 0.5 )' , 42501 );
SELECT * FROM finish( );
ROLLBACK;