feature #7: add query "find_comments_article_by_citizen" and "find_comments_constitution_by_citizen"

This commit is contained in:
2019-08-26 01:04:42 +02:00
parent f167cf02f9
commit ce38aa6fe2
3 changed files with 69 additions and 2 deletions

View File

@@ -62,8 +62,21 @@ begin
select resource, total
into _selected_comments, _selected_comments_total
from find_comments_by_citizen(_citizen_id);
assert (_selected_comments_total = 1), 'the number of comments for this citizen must be 1';
assert (_selected_comments#>>'{0,content}' = 'edited content'), 'the content of first comment for this citizen must be "edited content", "' || (_selected_comments#>>'{0,content}') || '" returned';
assert (_selected_comments_total = 1), 'the number of comments for this citizen must be 1, "' || _selected_comments_total || '" returned';
assert (_selected_comments#>>'{0,content}' = 'edited content'),
'the content of first comment for this citizen must be "edited content", "' || (_selected_comments#>>'{0,content}') || '" returned';
select resource, total
into _selected_comments, _selected_comments_total
from find_comments_article_by_citizen(_citizen_id);
assert (_selected_comments_total = 1), 'the number of comments for this citizen must be 1, "' || _selected_comments_total || '" returned';
assert (_selected_comments#>>'{0,content}' = 'edited content'),
'the content of first comment for this citizen must be "edited content", "' || (_selected_comments#>>'{0,content}') || '" returned';
select resource, total
into _selected_comments, _selected_comments_total
from find_comments_constitution_by_citizen(_citizen_id);
assert (_selected_comments_total = 0), 'the number of comments for this citizen must be 0, "' || _selected_comments_total || '" returned';
-- delete comment and context
delete from "comment";