From 09b7a7804253711c81e9a2f87b864fa295671ef5 Mon Sep 17 00:00:00 2001 From: Augusto Herrmann Date: Fri, 23 Aug 2024 18:18:19 -0300 Subject: [PATCH] Fix expected data structure in test parameters (partial) --- tests/parsers_test.py | 82 ++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/tests/parsers_test.py b/tests/parsers_test.py index daa0681..8698e1f 100644 --- a/tests/parsers_test.py +++ b/tests/parsers_test.py @@ -14,14 +14,14 @@ from dou_dag_generator import DouDigestDagGenerator, YAMLParser, DAGConfig - @pytest.mark.parametrize( "filepath, result_tuple", [ ( "basic_example.yaml", { - "dag_id": "basic_example", + "id": "basic_example", + "description": "DAG de teste", "search": [ { "terms": [ @@ -39,34 +39,37 @@ "field": "TUDO", "is_exact_search": True, "ignore_signature_match": False, - "force_rematch": None, - "full_text": None, - "use_summary": None, + "force_rematch": False, + "full_text": False, + "use_summary": False, "department": None, } ], - "emails": ["destination@economia.gov.br"], - "subject": "Teste do Ro-dou", - "attach_csv": False, - "discord_webhook": None, - "slack_webhook": None, - "schedule": None, - "dataset": None, - "description": "DAG de teste", - "skip_null": True, - "doc_md": None, - "dag_tags": {"dou", "generated_dag"}, - "owner": "", - "hide_filters": False, - "header_text": None, - "footer_text": None, - "no_results_found_text": "Nenhum dos termos pesquisados foi encontrado nesta consulta", + "report": { + "emails": ["destination@economia.gov.br"], + "subject": "Teste do Ro-dou", + "attach_csv": False, + "discord_webhook": None, + "slack_webhook": None, + "schedule": None, + "dataset": None, + "description": "DAG de teste", + "skip_null": True, + "doc_md": None, + "dag_tags": {"dou", "generated_dag"}, + "owner": [], + "hide_filters": False, + "header_text": None, + "footer_text": None, + "no_results_found_text": "Nenhum dos termos pesquisados " + "foi encontrado nesta consulta", + }, }, ), ( "all_parameters_example.yaml", { - "dag_id": "all_parameters_example", + "id": "all_parameters_example", "search": [ { "terms": [ @@ -111,7 +114,7 @@ ( "terms_from_db_example.yaml", { - "dag_id": "terms_from_db_example", + "id": "terms_from_db_example", "search": [ { "terms": [], @@ -149,7 +152,7 @@ "skip_null": True, "doc_md": None, "dag_tags": {"dou", "generated_dag"}, - "owner": "", + "owner": [], "hide_filters": False, "header_text": None, "footer_text": None, @@ -159,7 +162,7 @@ ( "basic_example_skip_null.yaml", { - "dag_id": "basic_example_skip_null", + "id": "basic_example_skip_null", "search": [ { "terms": ["cimentodaaroeira"], @@ -190,7 +193,7 @@ "skip_null": False, "doc_md": None, "dag_tags": {"dou", "generated_dag"}, - "owner": "", + "owner": [], "hide_filters": False, "header_text": None, "footer_text": None, @@ -200,7 +203,7 @@ ( "markdown_docs_example.yaml", { - "dag_id": "markdown_docs_example", + "id": "markdown_docs_example", "search": [ { "terms": [ @@ -243,7 +246,7 @@ * ou colocar [links](graph)!""" ).strip(), "dag_tags": {"dou", "generated_dag"}, - "owner": "", + "owner": [], "hide_filters": False, "header_text": None, "footer_text": None, @@ -253,7 +256,7 @@ ( "department_example.yaml", { - "dag_id": "department_example", + "id": "department_example", "search": [ { "terms": ["dados abertos"], @@ -287,7 +290,7 @@ "skip_null": True, "doc_md": None, "dag_tags": {"dou", "generated_dag"}, - "owner": "", + "owner": [], "hide_filters": False, "header_text": None, "footer_text": None, @@ -297,7 +300,7 @@ ( "inlabs_example.yaml", { - "dag_id": "inlabs_example", + "id": "inlabs_example", "search": [ { "terms": ["tecnologia", "informação"], @@ -338,7 +341,7 @@ ( "inlabs_advanced_search_example.yaml", { - "dag_id": "inlabs_advanced_search_example", + "id": "inlabs_advanced_search_example", "search": [ { "terms": [ @@ -382,7 +385,7 @@ ( "multiple_searchs_example.yaml", { - "dag_id": "multiple_searchs_example", + "id": "multiple_searchs_example", "search": [ { "terms": [ @@ -438,7 +441,7 @@ "skip_null": False, "doc_md": None, "dag_tags": {"dou", "generated_dag", "inlabs"}, - "owner": "", + "owner": [], "hide_filters": False, "header_text": None, "footer_text": None, @@ -448,7 +451,7 @@ ( "hide_filters_example.yaml", { - "dag_id": "hide_filters_example", + "id": "hide_filters_example", "search": [ { "terms": ["tecnologia", "informação"], @@ -482,7 +485,7 @@ "skip_null": True, "doc_md": None, "dag_tags": {"dou", "inlabs", "generated_dag"}, - "owner": "", + "owner": [], "hide_filters": True, "header_text": None, "footer_text": None, @@ -492,7 +495,7 @@ ( "header_and_footer_example.yaml", { - "dag_id": "header_and_footer_example", + "id": "header_and_footer_example", "search": [ { "terms": ["tecnologia", "informação"], @@ -523,7 +526,7 @@ "skip_null": True, "doc_md": None, "dag_tags": {"dou", "generated_dag"}, - "owner": "", + "owner": [], "hide_filters": False, "header_text": "

Greetings

", "footer_text": "

Best Regards

", @@ -532,11 +535,10 @@ ), ], ) - def test_parse(filepath, result_tuple): filepath = os.path.join( DouDigestDagGenerator().YAMLS_DIR, "examples_and_tests", filepath ) parsed = YAMLParser(filepath=filepath).parse() - assert parsed == DAGConfig(**result_tuple) + assert parsed.model_dump() == DAGConfig(**result_tuple).model_dump()