コード例 #1
0
ファイル: test_client.py プロジェクト: nfarina/plaid-python
def test_connect_step_device_phone():
    client = Client('test_id', 'test_secret', access_token='test_chase')
    response = client.connect_step('chase', None, options={
        'send_method': {'type': 'phone'}
    })
    assert response.status_code == 201
    assert to_json(response)['type'] == 'device'
    assert to_json(response)['mfa']['message'] == 'Code sent to xxx-xxx-5309'
コード例 #2
0
def test_connect_step_device_phone():
    client = Client('test_id', 'test_secret', access_token='test_chase')
    response = client.connect_step('chase',
                                   None,
                                   options={'send_method': {
                                       'type': 'phone'
                                   }})
    assert response.status_code == 201
    assert to_json(response)['type'] == 'device'
    assert to_json(response)['mfa']['message'] == 'Code sent to xxx-xxx-5309'
コード例 #3
0
 def inner_func(self, *args, **kwargs):
     response = func(self, *args, **kwargs)
     if response.ok:
         json_data = to_json(response)
         self.access_token = json_data.get('access_token',
                                           self.access_token)
     return response
コード例 #4
0
ファイル: test_client.py プロジェクト: nfarina/plaid-python
def test_institution():
    client = Client('test_id', 'test_secret')
    response = client.institution(
        to_json(client.institutions())[0]['id']
    )

    assert response.status_code == 200
コード例 #5
0
ファイル: requester.py プロジェクト: aatreya/plaid-python
def http_request(url, method=None, data=None, suppress_errors=False):
    response = _base_http_request(url, method, data or {})
    ERROR = PLAID_ERROR_MAP.get(response.status_code)
    if not suppress_errors and ERROR is not None:
        json_data = to_json(response)
        raise ERROR(json_data['resolve'], json_data['code'])
    else:
        return response
コード例 #6
0
def http_request(url, method=None, data=None, suppress_errors=False):
    response = _base_http_request(url, method, data or {})
    ERROR = PLAID_ERROR_MAP.get(response.status_code)
    if not suppress_errors and ERROR is not None:
        json_data = to_json(response)
        raise ERROR(json_data['resolve'], json_data['code'])
    else:
        return response
コード例 #7
0
def test_connect_mfa_list():
    client = Client('test_id', 'test_secret')
    # These credentials erroneously still force mfa in the sandbox
    # Should disambiguate by disallowing institution on API level
    # for this particular calling
    response = client.connect('chase', no_mfa_credentials)
    assert response.status_code == 201
    assert to_json(response)['type'] == 'list'
コード例 #8
0
ファイル: test_client.py プロジェクト: nfarina/plaid-python
def test_connect_mfa_list():
    client = Client('test_id', 'test_secret')
    # These credentials erroneously still force mfa in the sandbox
    # Should disambiguate by disallowing institution on API level
    # for this particular calling
    response = client.connect('chase', no_mfa_credentials)
    assert response.status_code == 201
    assert to_json(response)['type'] == 'list'
コード例 #9
0
ファイル: test_client.py プロジェクト: nfarina/plaid-python
def test_ResourceNotFound_categories_with_suppressed_error():
    Client.config({'suppress_http_errors': True})
    client = Client('test_id', 'test_secret')
    response = client.category('pnc')
    assert response.status_code == 404
    assert (
        to_json(response)['message'] == 'unable to find category'
    )
コード例 #10
0
ファイル: client.py プロジェクト: paddyquinn/plaid-python
 def inner_func(self, *args, **kwargs):
     response = func(self, *args, **kwargs)
     if response.ok:
         json_data = to_json(response)
         self.access_token = json_data.get(
             'access_token',
             self.access_token
         )
     return response
コード例 #11
0
ファイル: test_client.py プロジェクト: nfarina/plaid-python
def test_exchange():
    client = Client('test_id', 'test_secret')
    response = client.exchange_token('test,chase,connected')
    assert response.status_code == 200
    assert to_json(response)['access_token'] == 'test_chase'
    assert client.access_token == 'test_chase'
コード例 #12
0
ファイル: test_client.py プロジェクト: nfarina/plaid-python
def test_connect_step_question_loop():
    client = Client('test_id', 'test_secret', access_token='test_bofa')
    response = client.connect_step('bofa', 'again')
    assert response.status_code == 201
    assert to_json(response)['type'] == 'questions'
コード例 #13
0
def test_upgrade():
    client = Client('test_id', 'test_secret', access_token='test_bofa')
    response = client.upgrade('info')
    assert response.status_code == 200
    assert 'info' in to_json(response).keys()
コード例 #14
0
ファイル: test_client.py プロジェクト: nfarina/plaid-python
def test_institution_search_with_bad_id():
    client = Client('test_id', 'test_secret')
    response = client.institution_search(institution_id='bad')
    assert response.status_code == 200
    assert len(to_json(response)) == 0
コード例 #15
0
def test_institution():
    client = Client('test_id', 'test_secret')
    response = client.institution(to_json(client.institutions())[0]['id'])

    assert response.status_code == 200
コード例 #16
0
def test_institution_search_with_bad_id():
    client = Client('test_id', 'test_secret')
    response = client.institution_search(institution_id='bad')
    assert response.status_code == 200
    assert len(to_json(response)) == 0
コード例 #17
0
ファイル: test_client.py プロジェクト: nfarina/plaid-python
def test_institution_search_with_bad_product():
    client = Client('test_id', 'test_secret')
    response = client.institution_search('wells fargo', 'bad')
    assert response.status_code == 200
    assert len(to_json(response)) == 0
コード例 #18
0
def test_connect_mfa_question():
    client = Client('test_id', 'test_secret')
    response = client.connect('bofa', no_mfa_credentials)
    assert response.status_code == 201
    assert to_json(response)['type'] == 'questions'
コード例 #19
0
def test_auth_no_mfa():
    client = Client('test_id', 'test_secret')
    response = client.auth('wells', no_mfa_credentials)
    assert to_json(response)['access_token'] == 'test_wells'
コード例 #20
0
def test_auth_delete():
    client = Client('test_id', 'test_secret', access_token='test_chase')
    response = client.auth_delete()
    assert response.status_code == 200
    assert to_json(response)['message'] == 'Successfully removed from system'
コード例 #21
0
def test_connect_no_mfa():
    client = Client('test_id', 'test_secret')
    response = client.connect('amex', no_mfa_credentials)
    assert response.status_code == 200
    assert to_json(response)['access_token'] == 'test_amex'
コード例 #22
0
def test_auth_step():
    client = Client('test_id', 'test_secret', access_token='test_pnc')
    response = client.auth_step('pnc', 'tomato')
    assert response.status_code == 200
    assert to_json(response)['access_token'] == 'test_pnc'
コード例 #23
0
def test_ResourceNotFound_categories_with_suppressed_error():
    Client.config({'suppress_http_errors': True})
    client = Client('test_id', 'test_secret')
    response = client.category('pnc')
    assert response.status_code == 404
    assert (to_json(response)['message'] == 'unable to find category')
コード例 #24
0
def test_auth_mfa():
    client = Client('test_id', 'test_secret')
    response = client.auth('pnc', no_mfa_credentials)
    assert response.status_code == 201
    assert to_json(response)['type'] == 'questions'
コード例 #25
0
ファイル: test_client.py プロジェクト: nfarina/plaid-python
def test_auth_no_mfa():
    client = Client('test_id', 'test_secret')
    response = client.auth('wells', no_mfa_credentials)
    assert to_json(response)['access_token'] == 'test_wells'
コード例 #26
0
def test_connect_step_question():
    client = Client('test_id', 'test_secret', access_token='test_bofa')
    response = client.connect_step('bofa', 'tomato')
    assert response.status_code == 200
    assert to_json(response)['access_token'] == 'test_bofa'
コード例 #27
0
ファイル: test_client.py プロジェクト: nfarina/plaid-python
def test_get_info():
    client = Client('test_id', 'test_secret', access_token='test_bofa')
    response = client.info_get()
    assert response.status_code == 200
    assert 'info' in to_json(response)
    assert 'names' in to_json(response)['info']
コード例 #28
0
ファイル: test_client.py プロジェクト: nfarina/plaid-python
def test_auth_step():
    client = Client('test_id', 'test_secret', access_token='test_pnc')
    response = client.auth_step('pnc', 'tomato')
    assert response.status_code == 200
    assert to_json(response)['access_token'] == 'test_pnc'
コード例 #29
0
ファイル: test_client.py プロジェクト: nfarina/plaid-python
def test_institution_search_with_multi_tokens():
    client = Client('test_id', 'test_secret')
    response = client.institution_search('wells fargo', 'auth')
    assert response.status_code == 200
    assert to_json(response)[0]['name'] == 'Wells Fargo'
コード例 #30
0
ファイル: test_client.py プロジェクト: nfarina/plaid-python
def test_connect_no_mfa():
    client = Client('test_id', 'test_secret')
    response = client.connect('amex', no_mfa_credentials)
    assert response.status_code == 200
    assert to_json(response)['access_token'] == 'test_amex'
コード例 #31
0
ファイル: test_client.py プロジェクト: nfarina/plaid-python
def test_auth_mfa():
    client = Client('test_id', 'test_secret')
    response = client.auth('pnc', no_mfa_credentials)
    assert response.status_code == 201
    assert to_json(response)['type'] == 'questions'
コード例 #32
0
def test_exchange():
    client = Client('test_id', 'test_secret')
    response = client.exchange_token('test,chase,connected')
    assert response.status_code == 200
    assert to_json(response)['access_token'] == 'test_chase'
    assert client.access_token == 'test_chase'
コード例 #33
0
def test_connect_step_question_loop():
    client = Client('test_id', 'test_secret', access_token='test_bofa')
    response = client.connect_step('bofa', 'again')
    assert response.status_code == 201
    assert to_json(response)['type'] == 'questions'
コード例 #34
0
def test_get_info():
    client = Client('test_id', 'test_secret', access_token='test_bofa')
    response = client.info_get()
    assert response.status_code == 200
    assert 'info' in to_json(response)
    assert 'names' in to_json(response)['info']
コード例 #35
0
ファイル: test_client.py プロジェクト: nfarina/plaid-python
def test_auth_delete():
    client = Client('test_id', 'test_secret', access_token='test_chase')
    response = client.auth_delete()
    assert response.status_code == 200
    assert to_json(response)['message'] == 'Successfully removed from system'
コード例 #36
0
def test_risk_step():
    client = Client('test_id', 'test_secret', access_token='test_chase')
    response = client.risk_step('chase', '1234')
    assert response.status_code == 200
    assert to_json(response)['access_token'] == 'test_chase'
コード例 #37
0
ファイル: test_client.py プロジェクト: nfarina/plaid-python
def test_connect_mfa_question():
    client = Client('test_id', 'test_secret')
    response = client.connect('bofa', no_mfa_credentials)
    assert response.status_code == 201
    assert to_json(response)['type'] == 'questions'
コード例 #38
0
def test_institution_search_with_bad_product():
    client = Client('test_id', 'test_secret')
    response = client.institution_search('wells fargo', 'bad')
    assert response.status_code == 200
    assert len(to_json(response)) == 0
コード例 #39
0
ファイル: test_client.py プロジェクト: nfarina/plaid-python
def test_connect_step_question():
    client = Client('test_id', 'test_secret', access_token='test_bofa')
    response = client.connect_step('bofa', 'tomato')
    assert response.status_code == 200
    assert to_json(response)['access_token'] == 'test_bofa'
コード例 #40
0
ファイル: test_client.py プロジェクト: nfarina/plaid-python
def test_upgrade():
    client = Client('test_id', 'test_secret', access_token='test_bofa')
    response = client.upgrade('info')
    assert response.status_code == 200
    assert 'info' in to_json(response).keys()
コード例 #41
0
def test_institution_search_with_multi_tokens():
    client = Client('test_id', 'test_secret')
    response = client.institution_search('wells fargo', 'auth')
    assert response.status_code == 200
    assert to_json(response)[0]['name'] == 'Wells Fargo'
コード例 #42
0
def test_risk_step():
    client = Client('test_id', 'test_secret', access_token='test_chase')
    response = client.risk_step('chase', '1234')
    assert response.status_code == 200
    assert to_json(response)['access_token'] == 'test_chase'