Skip to content

Commit

Permalink
Fix expected data structure in test parameters (partial)
Browse files Browse the repository at this point in the history
  • Loading branch information
augusto-herrmann committed Aug 23, 2024
1 parent 05deb93 commit 09b7a78
Showing 1 changed file with 42 additions and 40 deletions.
82 changes: 42 additions & 40 deletions tests/parsers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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": ["[email protected]"],
"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": ["[email protected]"],
"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": [
Expand Down Expand Up @@ -111,7 +114,7 @@
(
"terms_from_db_example.yaml",
{
"dag_id": "terms_from_db_example",
"id": "terms_from_db_example",
"search": [
{
"terms": [],
Expand Down Expand Up @@ -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,
Expand All @@ -159,7 +162,7 @@
(
"basic_example_skip_null.yaml",
{
"dag_id": "basic_example_skip_null",
"id": "basic_example_skip_null",
"search": [
{
"terms": ["cimentodaaroeira"],
Expand Down Expand Up @@ -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,
Expand All @@ -200,7 +203,7 @@
(
"markdown_docs_example.yaml",
{
"dag_id": "markdown_docs_example",
"id": "markdown_docs_example",
"search": [
{
"terms": [
Expand Down Expand Up @@ -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,
Expand All @@ -253,7 +256,7 @@
(
"department_example.yaml",
{
"dag_id": "department_example",
"id": "department_example",
"search": [
{
"terms": ["dados abertos"],
Expand Down Expand Up @@ -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,
Expand All @@ -297,7 +300,7 @@
(
"inlabs_example.yaml",
{
"dag_id": "inlabs_example",
"id": "inlabs_example",
"search": [
{
"terms": ["tecnologia", "informação"],
Expand Down Expand Up @@ -338,7 +341,7 @@
(
"inlabs_advanced_search_example.yaml",
{
"dag_id": "inlabs_advanced_search_example",
"id": "inlabs_advanced_search_example",
"search": [
{
"terms": [
Expand Down Expand Up @@ -382,7 +385,7 @@
(
"multiple_searchs_example.yaml",
{
"dag_id": "multiple_searchs_example",
"id": "multiple_searchs_example",
"search": [
{
"terms": [
Expand Down Expand Up @@ -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,
Expand All @@ -448,7 +451,7 @@
(
"hide_filters_example.yaml",
{
"dag_id": "hide_filters_example",
"id": "hide_filters_example",
"search": [
{
"terms": ["tecnologia", "informação"],
Expand Down Expand Up @@ -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,
Expand All @@ -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"],
Expand Down Expand Up @@ -523,7 +526,7 @@
"skip_null": True,
"doc_md": None,
"dag_tags": {"dou", "generated_dag"},
"owner": "",
"owner": [],
"hide_filters": False,
"header_text": "<p><strong>Greetings<strong></p>",
"footer_text": "<p>Best Regards</p>",
Expand All @@ -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()

0 comments on commit 09b7a78

Please sign in to comment.