def test_file_date(self): with open(self.filename, 'wb') as fd: fd.write(_format(''' "Kontonummer:";"{iban} / Girokonto"; "Von:";"01.01.2018"; "Bis:";"31.01.2018"; "Kontostand vom 31.01.2018:";"5.000,01 EUR"; {header}; "20.01.2018";"";"";"";"Tagessaldo";"";"";"2.500,01"; ''', dict(iban=self.iban, header=HEADER))) # NOQA importer = ECImporter(self.iban, 'Assets:DKB:EC', file_encoding='utf-8') with open(self.filename) as fd: self.assertEqual(importer.file_date(fd), datetime.date(2018, 1, 31))
def test_file_date_is_set_correctly(tmp_file): tmp_file.write_text( _format( ''' "Kontonummer:";"{iban} / Girokonto"; "Von:";"01.01.2018"; "Bis:";"31.01.2018"; "Kontostand vom 31.01.2018:";"5.000,01 EUR"; {header}; "20.01.2018";"";"";"";"Tagessaldo";"";"";"2.500,01"; ''', dict(iban=IBAN, header=HEADER), ) ) importer = ECImporter(IBAN, 'Assets:DKB:EC', file_encoding='utf-8') with tmp_file.open() as fd: assert importer.file_date(fd) == datetime.date(2018, 1, 31)
def test_file_date(tmp_file): tmp_file.write( _format( ''' "Kontonummer:";"{iban} / Girokonto"; "Von:";"01.01.2018"; "Bis:";"31.01.2018"; "Kontostand vom 31.01.2018:";"5.000,01 EUR"; {header}; "20.01.2018";"";"";"";"Tagessaldo";"";"";"2.500,01"; ''', dict(iban=Constants.iban.value, header=Constants.header.value), )) importer = ECImporter(Constants.iban.value, 'Assets:DKB:EC', file_encoding='utf-8') with open(str(tmp_file.realpath())) as fd: assert importer.file_date(fd) == datetime.date(2018, 1, 31)