Exemple #1
0
    def util_add_account(self):
        account = Account(
            account_type=random.choice(list(AccountTypes)),
            account_name=KeyGenerator.generateuuid()
        )

        self.client.add_account(account, balance=random.randint(-10, 10), balance_date=datetime.now())
Exemple #2
0
    def test_add_delete_account(self):
        account_type=AccountTypes.Checking
        account_name = KeyGenerator.generateuuid()
        budget = self.client.budget

        for account in budget.be_accounts:
            if account.account_name == account_name:
                return
        if len(budget.be_accounts) > 0:
            sortable_index = max(account.sortable_index for account in budget.be_accounts)
        else:
            sortable_index = 0

        account = Account(
            account_type=account_type,
            account_name=account_name,
            sortable_index=sortable_index,
        )

        self.client.add_account(account, balance=random.randint(-10, 10), balance_date=datetime.now())

        self.reload()

        self.assertIn(account, self.client.budget.be_accounts)

        self.client.delete_account(account)

        self.reload()

        result = self.client.budget.be_transactions.get(account.id)

        self.assertTrue(result is None)
Exemple #3
0
    def test_add_delete_account(self):
        account_type = AccountTypes.Checking
        account_name = KeyGenerator.generateuuid()
        budget = self.client.budget

        for account in budget.be_accounts:
            if account.account_name == account_name:
                return
        if len(budget.be_accounts) > 0:
            sortable_index = max(account.sortable_index
                                 for account in budget.be_accounts)
        else:
            sortable_index = 0

        account = Account(
            account_type=account_type,
            account_name=account_name,
            sortable_index=sortable_index,
        )

        self.client.add_account(account,
                                balance=random.randint(-10, 10),
                                balance_date=datetime.now())

        self.reload()

        self.assertIn(account, self.client.budget.be_accounts)

        self.client.delete_account(account)

        self.reload()

        result = self.client.budget.be_transactions.get(account.id)

        self.assertTrue(result is None)
Exemple #4
0
def util_add_account(client, account_name=None):
    if account_name is None:
        account_name = str(KeyGenerator.generateuuid())
    account = Account(account_type=random.choice(list(AccountTypes)),
                      account_name=account_name)

    client.add_account(account,
                       balance=random.randint(-10, 10),
                       balance_date=datetime.now())
    return account
Exemple #5
0
 def test_add_delete_budget(self):
     budget_name=KeyGenerator.generateuuid()
     self.client.create_budget(budget_name)
     self.reload()
     matches=[b for b in self.client.catalog.ce_budgets if b.budget_name==budget_name]
     self.assertTrue(len(matches) == 1)
     self.client.delete_budget(budget_name)
     self.reload()
     matches=[b for b in self.client.catalog.ce_budgets if b.budget_name==budget_name]
     self.assertTrue(len(matches) == 0)
     self.reload()
Exemple #6
0
 def test_add_delete_budget(self):
     budget_name = KeyGenerator.generateuuid()
     self.client.create_budget(budget_name)
     self.reload()
     matches = [
         b for b in self.client.catalog.ce_budgets
         if b.budget_name == budget_name
     ]
     self.assertTrue(len(matches) == 1)
     self.client.delete_budget(budget_name)
     self.reload()
     matches = [
         b for b in self.client.catalog.ce_budgets
         if b.budget_name == budget_name
     ]
     self.assertTrue(len(matches) == 0)
     self.reload()
Exemple #7
0
 def create_id(self, *args, **kwargs):
     return KeyGenerator.generateuuid()