Skip to content

Commit

Permalink
Create test to implementation qd_list_territory_id
Browse files Browse the repository at this point in the history
  • Loading branch information
salomaolopes committed Oct 24, 2024
1 parent ad9b030 commit 13c122a
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
47 changes: 47 additions & 0 deletions tests/parsers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,53 @@
},
},
),
(
"qd_list_territory_id_example.yaml",
{
"id": "qd_list_territory_id_example",
"description": "DAG de teste com múltiplos territory_id",
"schedule": '0 8 * * MON-FRI',
"dataset": None,
"doc_md": None,
"tags": {"dou", "generated_dag"},
"owner": [],
"search": [
{
"terms": [
"LGPD",
"RIO DE JANEIRO",
],
"header": "Teste com múltiplos territory_id",
"sources": ["QD"],
"sql": None,
"conn_id": None,
"territory_id": [3300100,3300159,3300209,3305703],
"dou_sections": ["TODOS"],
"search_date": "DIA",
"field": "TUDO",
"is_exact_search": True,
"ignore_signature_match": True,
"force_rematch": True,
"full_text": False,
"use_summary": False,
"department": None,
}
],
"report": {
"emails": ["[email protected]"],
"subject": "Teste do Ro-dou",
"attach_csv": False,
"discord_webhook": None,
"slack_webhook": None,
"skip_null": False,
"hide_filters": False,
"header_text": None,
"footer_text": None,
"no_results_found_text": "Nenhum dos termos pesquisados "
"foi encontrado nesta consulta",
},
},
),
],
)
def test_parse(filepath, result_tuple):
Expand Down
20 changes: 20 additions & 0 deletions tests/qd_searcher_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,23 @@ def test_build_query_payload(pre_tags: str,
]

assert payload == expected


@pytest.mark.parametrize(
'territory_id, expected_payload',
[
(3300100, [('territory_ids', 3300100)]),
([3300100, 3300159], [('territory_ids', 3300100), ('territory_ids', 3300159)]),
]
)
def test_search_with_multiple_territory_ids(territory_id, expected_payload):
#searcher = QDSearcher()
payload = []

# Simula a lógica que foi alterada para suportar múltiplos IDs de território
if isinstance(territory_id, int):
territory_id = [territory_id]
for terr_id in territory_id:
payload.append(('territory_ids', terr_id))

assert payload == expected_payload

0 comments on commit 13c122a

Please sign in to comment.