Esempio n. 1
0
 def test_budget_account(self):
     proto_budget = BudgetAccountFactory()
     assert (reverse("budget:budget_account",
                     kwargs={"account_id": proto_budget.id
                             }) == f"/budget/b/{proto_budget.id}")
     assert resolve(f"/budget/b/{proto_budget.id}"
                    ).view_name == "budget:budget_account"
Esempio n. 2
0
    def test_clean_budget_account(self):
        budget_account = BudgetAccountFactory()

        form = BudgetAccountForm({
            "name": budget_account.name,
            "account_type": budget_account.account_type.id,
            "contribution_amount": budget_account.contribution_amount,
            "month_intervals": budget_account.month_intervals,
            "user": budget_account.user.id,
            "active": budget_account.active
        })
        self.assertTrue(form.is_valid())
        form.save()
Esempio n. 3
0
    def test_manager_find_all_shares_one_budget(self):
        proto_budget2 = BudgetAccountFactory()
        StockSharesFactory(stock=self.proto_stock,
                           brokerage_account=self.proto_broker,
                           budget_account=self.proto_budget)
        stock_shares2 = StockSharesFactory(stock=self.proto_stock,
                                           brokerage_account=self.proto_broker,
                                           budget_account=proto_budget2)

        all_shares = StockShares.objects.find_all_shares(
            self.proto_stock, budget_account=proto_budget2)

        self.assertQuerysetEqual(all_shares, [repr(stock_shares2)],
                                 ordered=False)
Esempio n. 4
0
def create_flex_account(user):
    acc_type = BudgetAccountTypeFactory(account_type='Flex')
    return BudgetAccountFactory(account_type=acc_type, user=user)
Esempio n. 5
0
 def setUp(self):
     self.proto_stock = StockFactory()
     self.proto_broker = BrokerageAccountFactory()
     self.proto_budget = BudgetAccountFactory()
 def setUp(self):
     self.budget_account = BudgetAccountFactory()