axione-elig-test/tests/test_axione_api.py
Johan Le Baut d2b53be534 add tests
2021-11-10 23:22:46 +01:00

36 lines
1.1 KiB
Python

import unittest
from axione_api.api import LigneResult, EtageResult, BatimentResult, parse_response
class TestAxioneApiParser(unittest.TestCase):
def test_parse_dummy_data_1(self):
with open("fixtures/dummy-data-1.xml", "r") as f:
data = f.read()
expectedLigne = LigneResult(
actif="false",
commercialisable="true",
existant="true",
raccordable="true",
rompu="false",
pbo="BA64_BIEM2 D 17-18",
pto="SPTH-BIEM2-0197",
)
expectedEtage = EtageResult(
reference="RDC",
nbLignesActives="2",
nbLignesExistantes="3",
nbLocauxFtth="3",
lignes=[expectedLigne],
)
expectedBatiment = BatimentResult(
etatBatiment="RACCORDABLE",
identifiantImmeuble="IMM64-497143",
referenceBatiment="RESIDENCE NORMAND PRINCE - BAT-C4",
etages=[expectedEtage],
)
expected = [expectedBatiment]
self.assertEqual(parse_response(data), expected)
if __name__ == "__main__":
unittest.main()