def test_investmentbucket_value_on(): """ Tests InvestmentBucket.value_on() """ user = user_helper() value_of_stock1 = 3 stock = Stock.create_new_stock(name="Name1X", ticker="TKRC") stock.daily_quote.create(value=value_of_stock1, date="2016-06-03") available = 3 bucket = InvestmentBucket(name="Bucket Test", public=True, owner=user.profile, available=available) bucket.save() InvestmentStockConfiguration( quantity=1, stock=stock, bucket=bucket, start="2016-06-08", end="2016-06-10", ).save() assert bucket.value_on() == available assert bucket.value_on(date="2016-06-08") == available + value_of_stock1 assert bucket.value_on(date="2016-07-19") == available
def test_bucket_value_on(): """ Tests to see if bucket properly handles exception """ user = User.objects.create(username='******', password="******") bucket = InvestmentBucket(name="bucket", public=True, owner=user.profile, available=10) bucket.save() assert bucket.value_on("2016-06-01") == 10