コード例 #1
0
ファイル: test_financing.py プロジェクト: kialj876/ppr
def test_get_statement(session, client, jwt, desc, roles, status, has_account,
                       reg_num):
    """Assert that a get financing statement by registration number works as expected."""
    current_app.config.update(AUTH_SVC_URL=MOCK_URL_NO_KEY)
    headers = None
    # setup
    if status == HTTPStatus.UNAUTHORIZED and desc.startswith('Report'):
        headers = create_header_account_report(jwt, roles)
    elif has_account and BCOL_HELP in roles:
        headers = create_header_account(jwt, roles, 'test-user', BCOL_HELP)
    elif has_account and STAFF_ROLE in roles:
        headers = create_header_account(jwt, roles, 'test-user', STAFF_ROLE)
    elif has_account and SBC_OFFICE in roles:
        headers = create_header_account(jwt, roles, 'test-user', SBC_OFFICE)
    elif has_account:
        headers = create_header_account(jwt, roles)
    else:
        headers = create_header(jwt, roles)

    # test
    response = client.get('/api/v1/financing-statements/' + reg_num,
                          headers=headers)

    # check
    assert response.status_code == status
コード例 #2
0
ファイル: test_search_results.py プロジェクト: kialj876/ppr
def test_get_search_detail(session, client, jwt, desc, roles, status,
                           has_account, search_id, is_report):
    """Assert that a get search detail info by search id works as expected."""
    current_app.config.update(AUTH_SVC_URL=MOCK_URL_NO_KEY)
    headers = None
    # setup
    if is_report:
        headers = create_header_account_report(jwt, roles)
    elif has_account and BCOL_HELP in roles:
        headers = create_header_account(jwt, roles, 'test-user', BCOL_HELP)
    elif has_account and STAFF_ROLE in roles:
        headers = create_header_account(jwt, roles, 'test-user', STAFF_ROLE)
    elif has_account and SBC_OFFICE in roles:
        headers = create_header_account(jwt, roles, 'test-user', SBC_OFFICE)
    elif has_account:
        headers = create_header_account(jwt, roles)
    else:
        headers = create_header(jwt, roles)
    # test
    rv = client.get('/api/v1/search-results/' + str(search_id),
                    headers=headers)

    # check
    # print(rv.json)
    assert rv.status_code == status
コード例 #3
0
ファイル: test_change.py プロジェクト: kialj876/ppr
def test_get_change(session, client, jwt, desc, roles, status, has_account,
                    reg_num, base_reg_num):
    """Assert that a get change registration statement works as expected."""
    headers = None
    # setup
    if status == HTTPStatus.UNAUTHORIZED and desc.startswith('Report'):
        headers = create_header_account_report(jwt, roles)
    elif has_account and BCOL_HELP in roles:
        headers = create_header_account(jwt, roles, 'test-user', BCOL_HELP)
    elif has_account and STAFF_ROLE in roles:
        headers = create_header_account(jwt, roles, 'test-user', STAFF_ROLE)
    elif has_account and SBC_OFFICE in roles:
        headers = create_header_account(jwt, roles, 'test-user', SBC_OFFICE)
    elif has_account:
        headers = create_header_account(jwt, roles)
    else:
        headers = create_header(jwt, roles)

    # test
    response = client.get('/api/v1/financing-statements/' + base_reg_num +
                          '/changes/' + reg_num,
                          headers=headers)

    # check
    assert response.status_code == status
    # basic verification statement data check
    if status == HTTPStatus.OK:
        json_data = response.json
        assert json_data['changeRegistrationNumber'] == reg_num
        assert len(json_data['changes']) >= 1
        assert json_data['changes'][0]['changeRegistrationNumber'] == reg_num
        if desc != 'Mismatch registrations staff':
            assert json_data['baseRegistrationNumber'] == base_reg_num
            assert json_data['changes'][0][
                'baseRegistrationNumber'] == base_reg_num