def testAccountsAvailableAfterParsingIndex(self): conn = MintConnection() index = open(testbase.fixturefile("mint_index.html")).read() expectedAccounts = { 1218040: {'name': 'PayPal PayPal Balance', 'balance': -4277.24}, 1218022: {'name': 'Wells Fargo Dojo Checking', 'balance': 19497.25} } conn._CachedSummary = index self.assertEqual(index, conn.GetSummary()) self.assertEqual(Mint.GetAccounts(), expectedAccounts) self.assertEqual(Mint.GetAccount(1218040), {'name': 'PayPal PayPal Balance', 'balance': -4277.24}) del conn._CachedSummary
def testAccountMintSyncWithFutureDates(self): model = self.Model a = model.CreateAccount("Foo") a.MintId = 1218040 # Put the fixture cached summary in, so we can test. from wxbanker.mint.api import MintConnection MintConnection()._CachedSummary = open(testbase.fixturefile("mint_index.html")).read() # Add the balance and we should be in sync. a.AddTransaction(-4277.24) self.assertTrue(a.IsInSync()) # Add a transaction today, we should be out of sync. t = a.AddTransaction(1) self.assertFalse(a.IsInSync()) # Change the date to tomorrow, we should be back in sync as of today. t.Date = tomorrow self.assertTrue(a.IsInSync())
def testAccountMintSync(self): model = self.Model a = model.CreateAccount("Foo") self.assertFalse(a.IsMintEnabled()) self.assertRaises(bankexceptions.MintIntegrationException, a.IsInSync) a.MintId = 1218040 self.assertEquals(1218040, a.GetMintId()) self.assertTrue(a.IsMintEnabled()) # Put the fixture cached summary in, so we can test. from wxbanker.mint.api import MintConnection MintConnection()._CachedSummary = open(testbase.fixturefile("mint_index.html")).read() self.assertFalse(a.IsInSync()) # Add the balance and we should be in sync. a.AddTransaction(-4277.24) self.assertTrue(a.IsInSync()) self.assertEqual(a.GetSyncString(), "PayPal PayPal Balance: -$4,277.24") del MintConnection()._CachedSummary
def getTransactions(self, csvtype): path = testbase.fixturefile("%s.csv" % csvtype) profile = CsvImporterProfileManager().getProfile(csvtype) container = CsvImporter().getTransactionsFromFile(path, profile) return container.Transactions
def getController(self, ver): origpath = testbase.fixturefile("bank-%s.db" % ver) self.tmpFile = tempfile.mkstemp()[1] shutil.copyfile(origpath, self.tmpFile) return Controller(path=self.tmpFile)
def getController(self, ver): origpath = testbase.fixturefile("bank-%s.db"%ver) self.tmpFile = tempfile.mkstemp()[1] shutil.copyfile(origpath, self.tmpFile) return Controller(path=self.tmpFile)
def getTransactions(self, csvtype): path = testbase.fixturefile("%s.csv"%csvtype) profile = CsvImporterProfileManager().getProfile(csvtype) container = CsvImporter().getTransactionsFromFile(path, profile) return container.Transactions