Fix sql test and add Command for lanch all sql test
This commit is contained in:
2
.idea/runConfigurations/All_Tests___Lint.xml
generated
2
.idea/runConfigurations/All_Tests___Lint.xml
generated
@@ -2,6 +2,7 @@
|
||||
<configuration default="false" name="All Tests + Lint" type="JUnit" factoryName="JUnit" show_console_on_std_err="true">
|
||||
<output_file path="$PROJECT_DIR$/var/log/test/out.log" is_save="true" />
|
||||
<module name="dcproject.test" />
|
||||
<useClassPathOnly />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="11" />
|
||||
<option name="PACKAGE_NAME" value="fr.dcproject" />
|
||||
@@ -20,6 +21,7 @@
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Lint" run_configuration_type="GradleRunConfiguration" />
|
||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Test All SQL" run_configuration_type="RunSql" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
71
.idea/runConfigurations/Test_All_SQL.xml
generated
Normal file
71
.idea/runConfigurations/Test_All_SQL.xml
generated
Normal file
@@ -0,0 +1,71 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Test All SQL" type="RunSql" factoryName="Run SQL">
|
||||
<option name="files">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/migrations/0000-init_schema.down.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/migrations/0000-init_schema.up.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/article/find_article_by_id.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/article/find_articles.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/article/find_articles_versions_by_id.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/article/find_articles_versions_by_version_id.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/article/find_last_article_by_version_id.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/article/upsert_article.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/citizen/find_citizen_by_email.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/citizen/find_citizen_by_id.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/citizen/find_citizen_by_id_with_user.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/citizen/find_citizen_by_user_id.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/citizen/find_citizen_by_username.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/citizen/find_citizens.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/citizen/insert_citizen_with_user.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/citizen/upsert_citizen.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/comment/comment.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/comment/edit_comment.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/comment/find_comment_by_id.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/comment/find_comments_by_citizen.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/comment/find_comments_by_parent.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/comment/find_comments_by_target.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/constitution/create_title_in_constitution.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/constitution/find_constitution_by_id.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/constitution/find_constitution_title_by_id.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/constitution/find_constitution_titles_by_id.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/constitution/find_constitutions.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/constitution/upsert_constitution.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/follow/find_follows_article_by_citizen.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/follow/find_follows_by_citizen.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/follow/find_follows_constitution_by_citizen.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/follow/follow.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/follow/unfollow.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/helpers/find_reference_by_id.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/helpers/random_between.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/opinion/count_opinion.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/opinion/opinion.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/user/change_user_password.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/user/check_user.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/user/find_user_by_id.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/user/find_user_by_username.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/user/insert_user.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/vote/vote.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/vote/count_vote.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/vote/find_citizen_votes_by_target_ids.sql" />
|
||||
<option value="$PROJECT_DIR$/src/main/resources/sql/functions/vote/find_votes_by_citizen.sql" />
|
||||
<option value="$PROJECT_DIR$/src/test/sql/user.sql" />
|
||||
<option value="$PROJECT_DIR$/src/test/sql/citizen.sql" />
|
||||
<option value="$PROJECT_DIR$/src/test/sql/article.sql" />
|
||||
<option value="$PROJECT_DIR$/src/test/sql/constitution.sql" />
|
||||
<option value="$PROJECT_DIR$/src/test/sql/comment.sql" />
|
||||
<option value="$PROJECT_DIR$/src/test/sql/follow.sql" />
|
||||
<option value="$PROJECT_DIR$/src/test/sql/vote.sql" />
|
||||
<option value="$PROJECT_DIR$/src/test/sql/opinion.sql" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="targets">
|
||||
<list>
|
||||
<Target>
|
||||
<option name="dsId" value="a9a6d0e9-327d-4e7d-9b93-3cb6f7948866" />
|
||||
<option name="namespace" value="database/"test"/schema/"public"" />
|
||||
</Target>
|
||||
</list>
|
||||
</option>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -5,7 +5,7 @@ declare
|
||||
created_user json := '{"username": "george", "plain_password": "azerty", "roles": ["ROLE_USER"]}';
|
||||
_user_id uuid;
|
||||
created_citizen json := '{"name": {"first_name":"George", "last_name":"MICHEL"}, "birthday": "2001-01-01", "email":"george.michel@gmail.com"}';
|
||||
created_citizen_with_user json := '{"name": {"first_name":"George", "last_name":"MICHEL"}, "birthday": "2001-01-01", "email":"george.michel@gmail.com", "user":{"username": "george junior", "plain_password": "azerty", "roles": ["ROLE_USER"]}}';
|
||||
created_citizen_with_user json := '{"name": {"first_name":"George", "last_name":"MICHEL"}, "birthday": "2001-01-01", "email":"george.michel2@gmail.com", "user":{"username": "george junior", "plain_password": "azerty", "roles": ["ROLE_USER"]}}';
|
||||
selected_citizen json;
|
||||
begin
|
||||
-- insert user for context
|
||||
|
||||
@@ -126,15 +126,12 @@ begin
|
||||
|
||||
select resource into _find_comments_by_target_result
|
||||
from find_comments_by_target((created_article->>'id')::uuid);
|
||||
assert json_array_length(_find_comments_by_target_result) = 3,
|
||||
'the result should contain 3 comment, ' || json_array_length(_find_comments_by_target_result) || ' returned';
|
||||
assert json_array_length(_find_comments_by_target_result) = 1,
|
||||
'the result should contain 1 comment, ' || json_array_length(_find_comments_by_target_result) || ' returned';
|
||||
assert (_find_comments_by_target_result#>>'{0,content}') = 'edited content', 'the first content must contain "edited content", "' || (_find_comments_by_target_result#>>'{0,content}') || '" returned';
|
||||
assert (_find_comments_by_target_result#>>'{1,content}') = 'God not exist', 'the second content must contain "God not exist", "' || (_find_comments_by_target_result#>>'{1,content}') || '" returned';
|
||||
assert (_find_comments_by_target_result#>>'{2,content}') = 'are you really sure ?', 'the third content must contain "are you really sure ?", "' || (_find_comments_by_target_result#>>'{2,content}') || '" returned';
|
||||
|
||||
raise notice '%', (_find_comments_by_target_result#>>'{0,id}');
|
||||
select resource into _find_comments_by_parent_result
|
||||
from find_comments_by_parent((_find_comments_by_target_result#>>'{1,id}')::uuid);
|
||||
from find_comments_by_parent(_comment_id_response);
|
||||
assert json_array_length(_find_comments_by_parent_result) = 1,
|
||||
'the result should contain 1 comment, ' || json_array_length(_find_comments_by_parent_result) || ' returned';
|
||||
assert (_find_comments_by_parent_result#>>'{0,content}') = 'are you really sure ?', 'the third content must contain "are you really sure ?", "' || (_find_comments_by_parent_result#>>'{1,content}') || '" returned';
|
||||
|
||||
@@ -22,7 +22,7 @@ declare
|
||||
"last_name": "Doe"
|
||||
},
|
||||
"birthday": "2002-01-01",
|
||||
"email":"george.michel@gmail.com"
|
||||
"email":"george.michel2@gmail.com"
|
||||
}
|
||||
$json$;
|
||||
begin
|
||||
|
||||
@@ -22,7 +22,7 @@ declare
|
||||
"last_name": "MICHEL2"
|
||||
},
|
||||
"birthday": "2001-01-02",
|
||||
"email":"george.michel@gmail.com"
|
||||
"email":"george.michel2@gmail.com"
|
||||
}
|
||||
$json$;
|
||||
created_article json := $json$
|
||||
|
||||
Reference in New Issue
Block a user