Beispiel #1
0
    def testThrowErrorForEmptyCashFile(self):
        with self.assertRaises(ValueError) as context:
            dkb2homebank.convert_DKB_cash('testfiles/cash_empty.csv')

        self.assertTrue("Can't convert CSV file without header line" in str(
            context.exception))
Beispiel #2
0
 def testShouldConvertCashFileAndWriteToAlternativeOutputDir(self):
     tmpdir = tempfile.gettempdir()
     dkb2homebank.convert_DKB_cash('testfiles/cash.csv',
                                   os.path.join(tmpdir, "cashHomebank.csv"))
Beispiel #3
0
 def testShouldConvertCashFile(self):
     dkb2homebank.convert_DKB_cash('testfiles/cash.csv', 'cashHomebank.csv')
     lineNumber = sum(1 for line in open('cashHomebank.csv'))
     self.assertEqual(lineNumber, 2)
Beispiel #4
0
 def testThrowErrorForEmptyCashFile(self):
     with self.assertRaises(ValueError) as context:
         with open('testfiles/cash_empty.csv', encoding='iso-8859-1') as csv_file:
             dkb2homebank.convert_DKB_cash(csv_file)
     self.assertTrue("Can't convert CSV file without header line" in str(context.exception))
Beispiel #5
0
 def testShouldConvertCashFileAndWriteToAlternativeOutputDir(self):
     with open(r'testfiles/cash.csv', encoding='iso-8859-1') as csv_file:
         tmpdir = tempfile.gettempdir()
         dkb2homebank.convert_DKB_cash(csv_file, os.path.join(tmpdir, "cashHomebank.csv"))
Beispiel #6
0
 def testShouldConvertCashFile(self):
     with open(r'testfiles/cash.csv', encoding='iso-8859-1') as csv_file:
         dkb2homebank.convert_DKB_cash(csv_file, 'cashHomebank.csv')
         csv_file.seek(0)
         lineNumber = len(dkb2homebank.find_transaction_lines(csv_file))
         self.assertEqual(lineNumber, 2)