Ejemplo n.º 1
0
def test_grapql_query_raises_exeption(monkeypatch, authentication_return):
    nubank_client = Nubank()

    response = create_fake_response({}, 401)

    monkeypatch.setattr('requests.post', MagicMock(return_value=response))
    with pytest.raises(NuException):
        nubank_client.get_account_balance()
Ejemplo n.º 2
0
def test_grapql_query_raises_exeption(monkeypatch, authentication_return, http_status):
    response = create_fake_response(authentication_return)
    monkeypatch.setattr('requests.post', MagicMock(return_value=response))
    nubank_client = Nubank('12345678909', '12345678')

    response = Response()
    response.status_code = http_status


    monkeypatch.setattr('requests.post', MagicMock(return_value=response))
    with pytest.raises(NuException):
        nubank_client.get_account_balance()
Ejemplo n.º 3
0
def test_get_account_balance():
    nubank_client = Nubank(client=MockHttpClient())
    nubank_client.authenticate_with_qr_code('12345678912', 'hunter12', 'some-uuid')

    balance = nubank_client.get_account_balance()

    assert balance == 127.33
Ejemplo n.º 4
0
def test_get_account_balance(monkeypatch, account_balance_return):
    monkeypatch.setattr(Discovery, '_update_proxy_urls', fake_update_proxy)
    monkeypatch.setattr(HttpClient, 'post', MagicMock(return_value=account_balance_return))
    nubank_client = Nubank()

    balance = nubank_client.get_account_balance()

    assert balance == 127.33
Ejemplo n.º 5
0
def test_get_account_balance(monkeypatch, authentication_return, account_balance_return):
    response = create_fake_response(authentication_return)
    monkeypatch.setattr('requests.post', MagicMock(return_value=response))
    nubank_client = Nubank('12345678909', '12345678')

    response = create_fake_response(account_balance_return)
    monkeypatch.setattr('requests.post', MagicMock(return_value=response))
    balance = nubank_client.get_account_balance()

    assert balance == 127.33