12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- import unittest
- import pytasks
- from pytasks import ca_webscraper
- from xml.dom import minidom
- class test_ca_webscraper(unittest.TestCase):
- def test_token(self):
- caws = ca_webscraper.ca_webscraper()
- token = caws.generate_token("AggAAABU5N5eAAAAAAoAAAD4TgT4GNq+GcN0FAAAAMSNhZfyUDWeIjCieNC6kfRhRLGSBwAAAFNIQS0yNTYgAAAATp4IDQBouepXMLDT+LyJsPuiXICYQxpZlfz8r4/W3aU=")
- self.assertEqual(token, "VjFOnggNAGi56lcwsNP4vImw+6JcgJhDGlmV/Pyvj9bdpQ==")
- token2 = caws.generate_token("AggAAAD8495eAAAAAAoAAADTxk26GoI5V7SSFAAAAMSNhZfyUDWeIjCieNC6kfRhRLGSBwAAAFNIQS0yNTYgAAAANRtS2ys6VqGk8EaJc88bLLBkSklun/rADunE7kEjFC4=")
- self.assertEqual(token2, "VjE1G1LbKzpWoaTwRolzzxsssGRKSW6f+sAO6cTuQSMULg==")
- def test_login(self):
- caws = ca_webscraper.ca_webscraper()
- self.assertEqual(caws.login(), 200)
- self.assertEqual(caws.caf[:3], "CAF")
- self.assertEqual(caws.cam[:2], "Vj")
- def test_report_list(self):
- caws = ca_webscraper.ca_webscraper()
- caws.login()
- result = caws.report_list()
- self.assertGreater(result.shape[0], 0)
- self.assertEqual(result['id'][0], "iA314AC05125D44F39261E2FD01782C51")
- #self.assertEqual(result['report'][0], "Teaminhalt + Service + S.01 Service-Geschäftsmetrik")
- def test_export(self):
- caws = ca_webscraper.ca_webscraper()
- report = { 'report': "Teaminhalt_Finanzbuchhaltung_F.01+Entwicklung+Zeitreihe+mit+EA",
- 'id': "i5DCC1FE29E784A78B3A58B41AB97FD89",
- 'short': "F.01",
- 'params': {
- 'p_Auswahl_Zeitraum': [ { 'display': "Einzelne Monate", 'use': "Einzelne Monate" } ],
- 'p_Zeitraum': [ { 'display': "Einzelner Monat", 'use': "[gewählter Monat]" } ],
- 'p_Von': [ { 'display': "01.01.2019", 'use': "2019-01-01" } ],
- 'p_Bis': [ { 'display': "31.12.2020", 'use': "2020-12-31" } ],
- 'p_AH': [ { 'display': "AH 2", 'use': "[CARLO_F_Belege].[AH-Gruppe].[AH-Gruppe].[Betrieb]->:[PC].[@MEMBER].[12]" } ]
- }
- }
- rep = minidom.parseString(caws.export(report))
- mydoc = minidom.parse("tests/soap/F-01.request.xml")
- self.maxDiff = None
- self.assertEqual(rep.toxml(), mydoc.toxml())
- if __name__ == '__main__':
- unittest.main()
|