import itertools import random from datetime import datetime from pynYNAB.Client import clientfromargs from pynYNAB.schema.budget import Transaction from pynYNAB.scripts.config import parser # used to ping the nYNAB API to check that the sync works args = parser.parse_known_args()[0] N = 2 client = clientfromargs(args) client.sync() account = next(acc for acc in client.budget.be_accounts) for _ in itertools.repeat(None, N): transaction = Transaction(cleared='Uncleared', date=datetime.now(), entities_account_id=account.id, amount=random.randrange(-10, 10)) client.add_transaction(transaction) client.sync()
def setUp(self): args = parser.parse_known_args()[0] self.client = clientfromargs(args, sync=False) self.client.sync_catalog() self.client.select_budget(test_budget_name)
def test_sync(): print('test_live') args = parser.parse_known_args()[0] client = clientfromargs(args) client.sync()
def reload(self): # parser = configargparse.getArgumentParser('pynYNAB') args = parser.parse_known_args()[0] self.client = clientfromargs(args)
def test_sync(): print('test_sync') args = parser.parse_known_args()[0] client = clientfromargs(args) client.sync()
import itertools import random from datetime import datetime from pynYNAB.Client import clientfromargs from pynYNAB.schema.budget import Transaction from pynYNAB.scripts.config import parser # used to ping the nYNAB API to check that the sync works args = parser.parse_known_args()[0] N=2 client = clientfromargs(args) client.sync() account = next(acc for acc in client.budget.be_accounts) for _ in itertools.repeat(None, N): transaction = Transaction( cleared='Uncleared', date=datetime.now(), entities_account_id=account.id, amount=random.randrange(-10,10) ) client.add_transaction(transaction) client.sync()