Emmanuel BENOîT
597429fadf
* Added session records to carry resource information over to the clients * Added SQL support code for the various views * Added interface and implementation of the resource information access component * Hooked resources information queries into both the empire and planet management component * Added resources display to planet and overview pages
57 lines
No EOL
1.5 KiB
PL/PgSQL
57 lines
No EOL
1.5 KiB
PL/PgSQL
/*
|
|
* Tests for defs.ordered_resources_view
|
|
*/
|
|
BEGIN;
|
|
|
|
/*
|
|
* We need:
|
|
* - one resource without category with weight 1,
|
|
* - one resource with category 1 and weight 2,
|
|
* - one resource with weight 4 and no category,
|
|
* - two resourcew with weights 3 and 7 and category 2.
|
|
*/
|
|
\i utils/strings.sql
|
|
SELECT _create_test_strings( 5 , 'resource' );
|
|
SELECT _create_test_strings( 5 , 'resDesc' );
|
|
SELECT _create_test_strings( 2 , 'resCat' );
|
|
|
|
INSERT INTO defs.resources(
|
|
resource_name_id , resource_description_id ,
|
|
resource_category_id , resource_weight
|
|
) VALUES (
|
|
_get_string( 'resource1' ) , _get_string( 'resDesc1' ) ,
|
|
NULL , 1
|
|
) , (
|
|
_get_string( 'resource2' ) , _get_string( 'resDesc2' ) ,
|
|
_get_string( 'resCat1' ) , 2
|
|
) , (
|
|
_get_string( 'resource3' ) , _get_string( 'resDesc3' ) ,
|
|
NULL , 4
|
|
) , (
|
|
_get_string( 'resource4' ) , _get_string( 'resDesc4' ) ,
|
|
_get_string( 'resCat2' ) , 3
|
|
) , (
|
|
_get_string( 'resource5' ) , _get_string( 'resDesc5' ) ,
|
|
_get_string( 'resCat2' ) , 7
|
|
);
|
|
|
|
SELECT plan( 1 );
|
|
SELECT diag_test_name( 'defs.ordered_resources_view - Resources are in the correct order' );
|
|
SELECT set_eq(
|
|
$$ SELECT resource_name_id , resource_ordering
|
|
FROM defs.ordered_resources_view $$ ,
|
|
$$ VALUES (
|
|
_get_string( 'resource1' ) , 1
|
|
) , (
|
|
_get_string( 'resource2' ) , 2
|
|
) , (
|
|
_get_string( 'resource3' ) , 3
|
|
) , (
|
|
_get_string( 'resource4' ) , 4
|
|
) , (
|
|
_get_string( 'resource5' ) , 5
|
|
) $$
|
|
);
|
|
|
|
SELECT * FROM finish( );
|
|
ROLLBACK; |