Skip to content

Commit 13c122a

Browse files
committed
Create test to implementation qd_list_territory_id
1 parent ad9b030 commit 13c122a

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

tests/parsers_test.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,53 @@
579579
},
580580
},
581581
),
582+
(
583+
"qd_list_territory_id_example.yaml",
584+
{
585+
"id": "qd_list_territory_id_example",
586+
"description": "DAG de teste com múltiplos territory_id",
587+
"schedule": '0 8 * * MON-FRI',
588+
"dataset": None,
589+
"doc_md": None,
590+
"tags": {"dou", "generated_dag"},
591+
"owner": [],
592+
"search": [
593+
{
594+
"terms": [
595+
"LGPD",
596+
"RIO DE JANEIRO",
597+
],
598+
"header": "Teste com múltiplos territory_id",
599+
"sources": ["QD"],
600+
"sql": None,
601+
"conn_id": None,
602+
"territory_id": [3300100,3300159,3300209,3305703],
603+
"dou_sections": ["TODOS"],
604+
"search_date": "DIA",
605+
"field": "TUDO",
606+
"is_exact_search": True,
607+
"ignore_signature_match": True,
608+
"force_rematch": True,
609+
"full_text": False,
610+
"use_summary": False,
611+
"department": None,
612+
}
613+
],
614+
"report": {
615+
"emails": ["destination@economia.gov.br"],
616+
"subject": "Teste do Ro-dou",
617+
"attach_csv": False,
618+
"discord_webhook": None,
619+
"slack_webhook": None,
620+
"skip_null": False,
621+
"hide_filters": False,
622+
"header_text": None,
623+
"footer_text": None,
624+
"no_results_found_text": "Nenhum dos termos pesquisados "
625+
"foi encontrado nesta consulta",
626+
},
627+
},
628+
),
582629
],
583630
)
584631
def test_parse(filepath, result_tuple):

tests/qd_searcher_test.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,23 @@ def test_build_query_payload(pre_tags: str,
7979
]
8080

8181
assert payload == expected
82+
83+
84+
@pytest.mark.parametrize(
85+
'territory_id, expected_payload',
86+
[
87+
(3300100, [('territory_ids', 3300100)]),
88+
([3300100, 3300159], [('territory_ids', 3300100), ('territory_ids', 3300159)]),
89+
]
90+
)
91+
def test_search_with_multiple_territory_ids(territory_id, expected_payload):
92+
#searcher = QDSearcher()
93+
payload = []
94+
95+
# Simula a lógica que foi alterada para suportar múltiplos IDs de território
96+
if isinstance(territory_id, int):
97+
territory_id = [territory_id]
98+
for terr_id in territory_id:
99+
payload.append(('territory_ids', terr_id))
100+
101+
assert payload == expected_payload

0 commit comments

Comments
 (0)