def test_statement_april2018(self): here = os.path.dirname(__file__) csvname = os.path.join(here, 'samples', '2018-april.csv') ofxname = os.path.join(here, 'samples', '2018-april.ofx') with NamedTemporaryFile() as output: convert(Namespace( type='revolut', input=csvname, output=output.name, )) self.assertTrue(filecmp.cmp(output.name, ofxname))
def test_convert_configured(self): inputfname = os.path.join(self.tmpdir, "input") outputfname = os.path.join(self.tmpdir, "output") args = mock.Mock(type="test", input=inputfname, output=outputfname) config = {"test": {"plugin": "sample"}} parser = mock.Mock() parser.parse.return_value = statement.Statement() sample_plugin = mock.Mock() sample_plugin.get_parser.return_value = parser configpatch = mock.patch("ofxstatement.configuration.read", return_value=config) pluginpatch = mock.patch("ofxstatement.plugin.get_plugin", return_value=sample_plugin) with configpatch, pluginpatch: ret = tool.convert(args) self.assertEqual(ret, 0) self.assertEqual( self.log.getvalue().splitlines(), ["INFO: Conversion completed: %s" % inputfname])
def test_convert_configured(self): inputfname = os.path.join(self.tmpdir, "input") outputfname = os.path.join(self.tmpdir, "output") args = mock.Mock(type="test", input=inputfname, output=outputfname) config = {"test": {"plugin": "sample"}} parser = mock.Mock() parser.parse.return_value = statement.Statement() sample_plugin = mock.Mock() sample_plugin.get_parser.return_value = parser configpatch = mock.patch("ofxstatement.configuration.read", return_value=config) pluginpatch = mock.patch("ofxstatement.plugin.get_plugin", return_value=sample_plugin) with configpatch, pluginpatch: ret = tool.convert(args) self.assertEqual(ret, 0) self.assertEqual(self.log.getvalue().splitlines(), ["INFO: Conversion completed: %s" % inputfname])