Esempio n. 1
0
def test_account_name():
    '''
    Testing PlaidMiddleware.PlaidAPI.account_name()
    '''
    client = plaid.Client(client_id='',
                          secret='',
                          public_key='',
                          environment='')
    user = PlaidMiddleware.PlaidAPI(access_token='', client=client)
    account_name = user.account_name()
    assert account_name == 'Test Account'
Esempio n. 2
0
def test_expenditure():
    '''
    Testing PlaidMiddleware.PlaidAPI.expenditure()
    '''
    client = plaid.Client(client_id='',
                          secret='',
                          public_key='',
                          environment='')
    user = PlaidMiddleware.PlaidAPI(access_token='', client=client)
    expenditure = user.expenditure()
    assert expenditure == -150
    expenditure2 = user.expenditure(days=5)
    assert expenditure2 == 0.0
Esempio n. 3
0
def test_current_balance():
    '''
    Testing PlaidMiddleware.PlaidAPI.current_balance()
    '''
    client = plaid.Client(client_id='',
                          secret='',
                          public_key='',
                          environment='')
    user = PlaidMiddleware.PlaidAPI(access_token='', client=client)
    balance = user.current_balance()
    assert balance == -9.0
    user.balance = 10
    balance = user.current_balance()
    assert balance == 10
Esempio n. 4
0
def test_income():
    '''
    Testing PlaidMiddleware.PlaidAPI.income()
    '''
    client = plaid.Client(client_id='',
                          secret='',
                          public_key='',
                          environment='')
    user = PlaidMiddleware.PlaidAPI(access_token='', client=client)
    income = user.income()
    assert income == 1135.0
    income2 = user.income(days=13)
    assert income2 == 1125.0
    income3 = user.income(days=11)
    assert income3 == 0
Esempio n. 5
0
def test_historical_data():
    '''
    Testing PlaidMiddleware.PlaidAPI.historical_data()
    '''
    client = plaid.Client(client_id='',
                          secret='',
                          public_key='',
                          environment='')
    user = PlaidMiddleware.PlaidAPI(access_token='', client=client)
    start_date = datetime.datetime.now() - datetime.timedelta(days=365)
    data = user.historical_data(start_date)

    end = datetime.datetime.now().strftime("%Y-%m-%d")
    mock_data = [
        (end, -9.0),
        ((datetime.datetime.now() -
          datetime.timedelta(days=10)).strftime("%Y-%m-%d"), -109.0),
        ((datetime.datetime.now() -
          datetime.timedelta(days=13)).strftime("%Y-%m-%d"), -1109.0),
    ]

    assert len(data) == len(mock_data)
    assert data == mock_data