Beispiel #1
0
 def test_addTrade(self):
   nj = self.makeTradeJsons(trades_json)
   db = DB('test.db')
   db.dropTables()
   for j in nj.values():
     if not (db.addTrade(json.dumps(j))):
       self.fail()
Beispiel #2
0
 def test_addSameClient(self):
   tst_db = DB('test.db')
   tst_db.dropTables()
   if not (tst_db.addClient(client_json)):
     self.fail()
   if tst_db.addClient(client_json):
     self.fail()
Beispiel #3
0
 def test_addPortfolio(self):
   nj = self.makeTradeJsons(trades_json)
   db = DB('test.db')
   db.dropTables()
   pf_j = self.fillPortfolioVars(db, nj)
   if not (db.addPortfolio(pf_j)):
     self.fail()
   if (db.addPortfolio(pf_j)):
     self.fail()
  def test_getTrades(self):
    nj = TestDB.makeTradeJsons()
    db = DB('test.db')
    db.dropTables()
    db.addClient(test_DB.client_json)
    pf_j = TestDB.fillPortfolioVars(db, nj)
    self.failIf(not (db.addPortfolio(pf_j)))

    cp = ClientPortfolios(db,'*****@*****.**')
    a = [p['portfolioName'] for p in cp.getPortfolios()]
    self.failIf( len(a) <= 0)
    self.failIf(len([t['tradeId'] for t in cp.getTrades('My portfolio')]) <= 0)
Beispiel #5
0
 def test_getTradeTbl(self):
   tst_db = DB('test.db')
   tst_db.dropTables()
   if not (tst_db.addTrade(trades_json)):
     self.fail()