| import os | |
| import pandas as pd | |
| import pytest | |
| from queries.process_all_db import ( | |
| all_dbs, | |
| process_all_tech_db, | |
| process_all_tech_db_with_stats, | |
| ) | |
| from utils.utils_vars import UtilsVars | |
| class TestProcessAllDB: | |
| def setup_method(self): | |
| UtilsVars.all_db_dfs = [] | |
| UtilsVars.final_all_database = None | |
| def test_all_dbs(self): | |
| filepath = r"C:\Users\David\Documents\PROJECTS\2023\PROJET 2023\DUMP\DUMP\NOVEMBRE\20241127_21145_27112024_Dump.xml.gz.xlsb" | |
| all_dbs(filepath) | |
| assert len(UtilsVars.all_db_dfs) == 8 | |
| assert isinstance(UtilsVars.all_db_dfs[0], pd.DataFrame) | |
| def test_process_all_tech_db(self): | |
| filepath = r"C:\Users\David\Documents\PROJECTS\2023\PROJET 2023\DUMP\DUMP\NOVEMBRE\20241127_21145_27112024_Dump.xml.gz.xlsb" | |
| process_all_tech_db(filepath) | |
| assert UtilsVars.final_all_database is not None | |
| def test_process_all_tech_db_with_stats(self): | |
| filepath = r"C:\Users\David\Documents\PROJECTS\2023\PROJET 2023\DUMP\DUMP\NOVEMBRE\20241127_21145_27112024_Dump.xml.gz.xlsb" | |
| process_all_tech_db_with_stats(filepath) | |
| assert UtilsVars.final_all_database is not None | |
| # def test_all_dbs_empty_file(self): | |
| # filepath = r"C:\Users\HP\Desktop\LTE\PROJET 2023\DUMP\2024\SEPTEMBRE\empty.xlsb" | |
| # all_dbs(filepath) | |
| # assert len(UtilsVars.all_db_dfs) == 0 | |
| # def test_process_all_tech_db_empty_file(self): | |
| # filepath = r"C:\Users\HP\Desktop\LTE\PROJET 2023\DUMP\2024\SEPTEMBRE\empty.xlsb" | |
| # process_all_tech_db(filepath) | |
| # assert UtilsVars.final_all_database is None | |
| # def test_process_all_tech_db_with_stats_empty_file(self): | |
| # filepath = r"C:\Users\HP\Desktop\LTE\PROJET 2023\DUMP\2024\SEPTEMBRE\empty.xlsb" | |
| # process_all_tech_db_with_stats(filepath) | |
| # assert UtilsVars.final_all_database is None | |