Beispiel #1
0
 def test_sigint(self, mock_quick_input):
     """Check that processed transactions are not lost on interruption.
     """
     qifqif.main()
     with io.open(OUT_FILE.name, 'r', encoding='utf-8') as fin:
         res = qifile.parse_lines(fin.readlines())
     self.assertEqual(res[0]['category'], 'Drink')
Beispiel #2
0
 def test_sigint(self, mock_quick_input):
     """Check that processed transactions are not lost on interruption."""
     qifqif.main()
     OUT_FILE.close()
     with io.open(OUT_FILE.name, "r", encoding="utf-8") as fin:
         res = qifile.parse_lines(fin.readlines())
     os.unlink(OUT_FILE.name)
     self.assertEqual(res[0]["category"], "Drink")
Beispiel #3
0
 def test_revert_on_eof(self, mock_quick_input):
     """Check that config and dest files are not edited when exiting on EOF.
     """
     res = qifqif.main()
     self.assertEqual(get_data(QIF_FILE), get_data(QIF_TEST_FILE))
     self.assertEqual(get_data(CONFIG_FILE), get_data(CONFIG_TEST_FILE))
     self.assertEqual(res, 1)
Beispiel #4
0
 def test_revert_on_eof(self, mock_quick_input):
     """Check that config and dest files are not edited when exiting on EOF."""
     qif_original = open(testdata.QIF_FILE, "rb").read()
     cfg_original = open(testdata.CFG_FILE, "rb").read()
     res = qifqif.main()
     self.assertEqual(qif_original, open(testdata.QIF_FILE, "rb").read())
     self.assertEqual(cfg_original, open(testdata.CFG_FILE, "rb").read())
     self.assertEqual(res, 1)
Beispiel #5
0
 def test_save_on_sigint(self, mock_quick_input):
     """Check that dest file has all transactions and has been edited.
     """
     res = qifqif.main()
     self.assertNotEqual(get_data(QIF_FILE), get_data(QIF_TEST_FILE))
     self.assertNotEqual(get_data(CONFIG_FILE), get_data(CONFIG_TEST_FILE))
     self.assertEqual(res, 1)
     self.assertEqual(len(qifqif.parse_file(
                      get_data(QIF_TEST_FILE, as_lines=True),
                      {'batch': True})), 3)
Beispiel #6
0
 def test_main(self):
     res = qifqif.main()
     self.assertEqual(res, 0)
Beispiel #7
0
 def test_main(self):
     res = qifqif.main()
     self.assertEqual(res, 0)
Beispiel #8
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (c) 2015-2020 Fabrice Laporte - kray.me
# The MIT License http://www.opensource.org/licenses/mit-license.php

import qifqif

if __name__ == "__main__":
    qifqif.main()
Beispiel #9
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (c) 2015 Fabrice Laporte - kray.me
# The MIT License http://www.opensource.org/licenses/mit-license.php


import qifqif

if __name__ == "__main__":
    qifqif.main()