diff --git a/tests/test_reference_values.sql b/tests/test_reference_values.sql index 210cbbaac57864dbfce33c002aa93a90504bc1b1..1fae4fcf1adf4b837dbbbf660165588514da2d70 100644 --- a/tests/test_reference_values.sql +++ b/tests/test_reference_values.sql @@ -48,23 +48,6 @@ INSERT INTO feature_config (_key, _value) VALUES ("ENTITY_VERSIONING", "ENABLED" -- TEST insertEntityProperty with Versioning - REFERENCE HEAD --- TODO assert throws -SET @VALUE="50@"; -CALL insertEntityProperty(0, @EntityID, @PropertyID, "reference_data", @Value, - NULL, "FIX", NULL, NULL, NULL, NULL, 0); - --- TODO switch expected/actual -SELECT tap.eq(0, domain_id, "domain ok") FROM reference_data; -SELECT tap.eq(99, entity_id, "entity ok") FROM reference_data; -SELECT tap.eq(11, property_id, "property ok") FROM reference_data; -SELECT tap.eq(50, value, "value ok") FROM reference_data; -SELECT tap.eq("FIX", status, "status ok") FROM reference_data; -SELECT tap.eq("0", pidx, "pidx ok") FROM reference_data; -SELECT tap.eq(value_iversion, NULL, "value_iversion ok") FROM reference_data; - -DELETE FROM reference_data WHERE domain_id=0 AND entity_id=99; - - SET @VALUE="50"; CALL insertEntityProperty(0, @EntityID, @PropertyID, "reference_data", @Value, NULL, "FIX", NULL, NULL, NULL, NULL, 0); @@ -82,8 +65,8 @@ DELETE FROM reference_data WHERE domain_id=0 AND entity_id=99; -- TEST insertEntityProperty with Versioning - Reference version -CALL insert_single_child_version(@EntityID, "hashbla", "versionbla", NULL, "SRIDbla"); -CALL insert_single_child_version(@EntityID, "hashblub", "versionblub", "versionbla", "SRIDblub"); +CALL insert_single_child_version(50, "hashbla", "versionbla", NULL, "SRIDbla"); +CALL insert_single_child_version(50, "hashblub", "versionblub", "versionbla", "SRIDblub"); SET @VALUE="50@versionbla"; CALL insertEntityProperty(0, @EntityID, @PropertyID, "reference_data", @Value, @@ -103,6 +86,7 @@ SET @VALUE="50@versionblub"; CALL insertEntityProperty(0, @EntityID, @PropertyID, "reference_data", @Value, NULL, "FIX", NULL, NULL, NULL, NULL, 0); +-- TODO switch expected/actual SELECT tap.eq(0, domain_id, "domain ok") FROM reference_data; SELECT tap.eq(99, entity_id, "entity ok") FROM reference_data; SELECT tap.eq(11, property_id, "property ok") FROM reference_data; @@ -111,7 +95,19 @@ SELECT tap.eq("FIX", status, "status ok") FROM reference_data; SELECT tap.eq("0", pidx, "pidx ok") FROM reference_data; SELECT tap.eq(value_iversion, "2", "value_iversion ok") FROM reference_data; --- TODO switch expected/actual + +-- invalid values throw errors +SET @VALUE="50@"; +CALL tap._assert_throws(' + CALL insertEntityProperty(0, @EntityID, @PropertyID, "reference_data", @Value, + NULL, "FIX", NULL, NULL, NULL, NULL, 0)', "@ but no version id"); + +SET @VALUE="50@non-existing-version"; +CALL tap._assert_throws(' + CALL insertEntityProperty(0, @EntityID, @PropertyID, "reference_data", @Value, + NULL, "FIX", NULL, NULL, NULL, NULL, 0)', "non-existing-version id"); + + -- #####################################################################