EAV / test_export_headers.py
github-actions[bot]
Deploy EAV 31f7732d473f7e16c1d8dd0202588849e4e886d1
8823504
Raw
History Blame Contribute Delete
1.12 kB
import tempfile
import unittest
from pathlib import Path
from unittest.mock import patch
from openpyxl import load_workbook
from app import export_plain_workbook
class ExportHeaderTests(unittest.TestCase):
def test_export_uses_the_same_labels_shown_in_the_interface(self):
payload = {
"headers": ["Entrada EAV", "RH_VALOR", "LA_PT_PTF", "ENVIO_SEI"],
"rows": [],
}
with tempfile.TemporaryDirectory() as directory:
with patch("app.GENERATED_DIR", Path(directory)):
output_path = export_plain_workbook(payload)
workbook = load_workbook(output_path, read_only=True)
try:
headers = [cell.value for cell in next(workbook.active.iter_rows())]
finally:
workbook.close()
self.assertEqual(
headers,
[
"Entrada Equipe",
"Valor RH",
"Trabalhos",
"Envio SEI",
"Comentários das Células",
],
)
if __name__ == "__main__":
unittest.main()