Valider les resource entrente #91

Merged
flecomte merged 46 commits from 21-valid-input into master 2021-04-16 03:27:11 +02:00
Showing only changes of commit 242bf9c9b3 - Show all commits

View File

@@ -22,7 +22,7 @@ begin
select "comment"( select "comment"(
reference => 'article'::regclass, reference => 'article'::regclass,
resource => _comment resource => _comment
) into _comment_id; )->>'id' into _comment_id;
assert (select count(*) = 1 from "comment"), 'comment must be inserted, "' || (select count(*) from "comment") || '" exist'; assert (select count(*) = 1 from "comment"), 'comment must be inserted, "' || (select count(*) from "comment") || '" exist';
assert (select com.content = 'Ho my god !' from "comment" com), 'the content of comment must be "Ho my god !" instead of "' || (select com.content from "comment" as com) || '"'; assert (select com.content = 'Ho my god !' from "comment" com), 'the content of comment must be "Ho my god !" instead of "' || (select com.content from "comment" as com) || '"';
@@ -67,7 +67,7 @@ begin
select "comment"( select "comment"(
reference => 'article'::regclass, reference => 'article'::regclass,
resource => _comment resource => _comment
) into _comment_id_response; )->>'id' into _comment_id_response;
_comment = json_build_object( _comment = json_build_object(
@@ -80,7 +80,7 @@ begin
select "comment"( select "comment"(
reference => 'article'::regclass, reference => 'article'::regclass,
resource => _comment resource => _comment
) into _comment_id_response2; )->>'id' into _comment_id_response2;
assert (select count(*) = 3 from "comment"), 'response must be inserted'; assert (select count(*) = 3 from "comment"), 'response must be inserted';
assert (select com.parents_ids @> ARRAY[_comment_id] from "comment" com where id = _comment_id_response), 'parents_ids not contain "' || _comment_id::text || '" ' || (select com.parents_ids::text[] from "comment" com where id = _comment_id_response); assert (select com.parents_ids @> ARRAY[_comment_id] from "comment" com where id = _comment_id_response), 'parents_ids not contain "' || _comment_id::text || '" ' || (select com.parents_ids::text[] from "comment" com where id = _comment_id_response);
assert (select com.parents_ids @> ARRAY[_comment_id_response] from "comment" com where id = _comment_id_response2), 'parents_ids not contain "' || _comment_id_response::text || '" ' || (select com.parents_ids::text[] from "comment" com where id = _comment_id_response2); assert (select com.parents_ids @> ARRAY[_comment_id_response] from "comment" com where id = _comment_id_response2), 'parents_ids not contain "' || _comment_id_response::text || '" ' || (select com.parents_ids::text[] from "comment" com where id = _comment_id_response2);