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)