def testToRemoveAllStocksAndGroups(self): stocks = getAllStocks() for stock in stocks: removeStock(stock) for i in range(0,12): stockGroups = getAllStockGroupsByClass(i) for stockGroup in stockGroups: removeStockGroups(stockGroup)
def testStockGroupAddingAndRemoving(self): stock1 = Stock(str(1),'test1', (0.2+ 0.01), (0.1 + 0.01)) stock2 = Stock(str(2),'test2', (0.2+ 0.01), (0.1 + 0.01)) stock3 = Stock(str(3),'test3', (0.2+ 0.01), (0.1 + 0.01)) assert ( saveStock(stock1) is True) assert ( saveStock(stock2) is True) assert ( saveStock(stock3) is True) stockGroupList = [stock1, stock2, stock3] stockGroup = StockGroup(stockGroupList) assert( saveStockGroup(stockGroup) is True) lookupStockGroup = getStockGroup(stockGroup) assert(lookupStockGroup is not None) assert(removeStockGroups(lookupStockGroup) is True) lookupStockGroup = getStockGroup(stockGroup) assert(lookupStockGroup is None) assert(removeStock(stock1) is True) assert(removeStock(stock2) is True) assert(removeStock(stock3) is True)
def testStockAddingAndRemoving(self): stock = Stock(str(9),'test9', (0.2+ 0.01), (0.1 + 0.01)) assert(saveStock(stock) is True) stock2 = getStock(stock) assert(stock2 is not None and stock2 == stock) val = removeStock(stock2) assert(val is True) stock2 = getStock(stock) assert(stock2 is None) assert(saveStock(stock) is True) stock2 = Stock(str(8),'test8', (0.2+ 0.01), (0.1 + 0.01)) assert(saveStock(stock2) is True) stockList = getAllStocks() assert(len(stockList) >=2 ) val = False for stockReturned in stockList: val = val or stockReturned.uid in ['9','8'] assert(val is True) for stockReturned in stockList: assert(removeStock(stockReturned) is True)