Emmanuel BENOîT
d38576a5cf
* Modified mining settings stored procedures to use text identifiers instead of numeric identifiers * Added DAO for mining settings and controller for resource operations * Added UpdateEmpireMiningSettingsCommand and associated command delegate. The command always returns NullResponse. * Overview page templates split into multiple files for clarity, added priority update form to the empire economy view and associated web server handler
43 lines
No EOL
1.7 KiB
PL/PgSQL
43 lines
No EOL
1.7 KiB
PL/PgSQL
/*
|
|
* Test the emp.mset_update_start( INT ) function
|
|
*/
|
|
BEGIN;
|
|
/* We need a pair of natural resources and an empire with mining settings. */
|
|
\i utils/strings.sql
|
|
\i utils/resources.sql
|
|
\i utils/accounts.sql
|
|
\i utils/naming.sql
|
|
\i utils/universe.sql
|
|
SELECT _create_natural_resources( 2 , 'natRes' );
|
|
SELECT _create_resources( 1 , 'basicRes' );
|
|
SELECT _create_raw_planets( 1 , 'testPlanet' );
|
|
SELECT _create_emp_names( 1 , 'testEmp' );
|
|
SELECT emp.create_empire( _get_emp_name( 'testEmp1' ) ,
|
|
_get_map_name( 'testPlanet1' ) ,
|
|
200.0 );
|
|
|
|
/***** TESTS BEGIN HERE *****/
|
|
SELECT plan( 6 );
|
|
|
|
SELECT diag_test_name( 'emp.mset_update_start( INT ) - Return value on bad empire identifier' );
|
|
SELECT ok( NOT emp.mset_update_start( _get_bad_emp_name( ) ) );
|
|
SELECT diag_test_name( 'emp.mset_update_start( INT ) - Temporary table exists despite bad empire identifier' );
|
|
SELECT has_table( 'mset_update' );
|
|
DROP TABLE IF EXISTS mset_update;
|
|
|
|
|
|
SELECT diag_test_name( 'emp.mset_update_start( INT ) - Return value on valid empire identifier' );
|
|
SELECT ok( emp.mset_update_start( _get_emp_name( 'testEmp1' ) ) );
|
|
SELECT diag_test_name( 'emp.mset_update_start( INT ) - Temporary table exists' );
|
|
SELECT has_table( 'mset_update' );
|
|
SELECT diag_test_name( 'emp.mset_update_start( INT ) - Temporary table contains all required entries' );
|
|
SELECT is( COUNT(*)::INT , 2 )
|
|
FROM mset_update
|
|
WHERE empire_id = _get_emp_name( 'testEmp1' );
|
|
SELECT diag_test_name( 'emp.mset_update_start( INT ) - Temporary table does not contain extra entries' );
|
|
SELECT is( COUNT(*)::INT , 0 )
|
|
FROM mset_update
|
|
WHERE empire_id <> _get_emp_name( 'testEmp1' );
|
|
|
|
SELECT * FROM finish( );
|
|
ROLLBACK; |