Пример #1
0
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()
Пример #2
0
 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)
Пример #3
0
 def test_sync():
     print('test_live')
     args = parser.parse_known_args()[0]
     client = clientfromargs(args)
     client.sync()
Пример #4
0
 def reload(self):
     # parser = configargparse.getArgumentParser('pynYNAB')
     args = parser.parse_known_args()[0]
     self.client = clientfromargs(args)
Пример #5
0
 def test_sync():
     print('test_sync')
     args = parser.parse_known_args()[0]
     client = clientfromargs(args)
     client.sync()
Пример #6
0
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()