Example #1
0
def test_get_account_codes(session, client, jwt, desc, staff, status, role,
                           account_id, has_data):
    """Assert that a get party code information by account ID returns the expected response code and data."""
    # setup
    headers = None
    if account_id:
        if staff:
            headers = create_header_account(jwt, [role, STAFF_ROLE],
                                            'test-user', account_id)
        else:
            headers = create_header_account(jwt, [role], 'test-user',
                                            account_id)
    else:
        if staff:
            headers = create_header(jwt, [role, STAFF_ROLE])
        else:
            headers = create_header(jwt, [role])

    # test
    rv = client.get('/api/v1/party-codes/accounts', headers=headers)
    # check
    assert rv.status_code == status
    if rv.status_code == HTTPStatus.OK:
        if has_data:
            assert rv.json
            client_code_json = rv.json
            assert len(client_code_json) > 0
            for client_party in client_code_json:
                assert client_party['code']
                assert client_party['businessName']
        else:
            assert not rv.json
Example #2
0
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
Example #3
0
def test_get_user_profile(session, client, jwt, desc, staff, include_account,
                          status, role):
    """Assert that a get user profile returns the expected response code and data."""
    # setup
    headers = None
    if include_account:
        if staff:
            headers = create_header_account(jwt, [role, STAFF_ROLE])
        else:
            headers = create_header_account(jwt, [role])
    else:
        if staff:
            headers = create_header(jwt, [role, STAFF_ROLE])
        else:
            headers = create_header(jwt, [role])

    # test
    rv = client.get('/api/v1/user-profile', headers=headers)
    # check
    assert rv.status_code == status
    if rv.status_code == HTTPStatus.OK:
        response_data = rv.json
        assert response_data
        assert 'paymentConfirmationDialog' in response_data
        assert 'selectConfirmationDialog' in response_data
        assert 'defaultDropDowns' in response_data
        assert 'defaultTableFilters' in response_data
Example #4
0
def test_create_amendment(session, client, jwt, desc, json_data, roles, status,
                          has_account, reg_num):
    """Assert that a post amendment registration statement works as expected."""
    headers = None
    # setup
    current_app.config.update(PAYMENT_SVC_URL=MOCK_PAY_URL)
    if 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.post('/api/v1/financing-statements/' + reg_num +
                           '/amendments',
                           json=json_data,
                           headers=headers,
                           content_type='application/json')

    # check
    # print('Response data:')
    # print(response.json)
    assert response.status_code == status
Example #5
0
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
Example #6
0
def test_get_party_codes(session, client, jwt, desc, staff, include_account,
                         status, role, search_value):
    """Assert that a get party code returns the expected response code and data."""
    # setup
    headers = None
    if include_account:
        if staff:
            headers = create_header_account(jwt, [role, STAFF_ROLE])
        else:
            headers = create_header_account(jwt, [role])
    else:
        if staff:
            headers = create_header(jwt, [role, STAFF_ROLE])
        else:
            headers = create_header(jwt, [role])

    # test
    rv = client.get(('/api/v1/party-codes/' + search_value), headers=headers)
    # check
    assert rv.status_code == status
    if rv.status_code == HTTPStatus.OK:
        assert rv.json
        assert 'contact' in rv.json
        assert 'address' in rv.json
        assert 'businessName' in rv.json
Example #7
0
def test_get_head_office_codes(session, client, jwt, desc, staff,
                               include_account, status, role, search_value):
    """Assert that a get head office party code information returns the expected response code and data."""
    # setup
    headers = None
    if include_account:
        if staff:
            headers = create_header_account(jwt, [role, STAFF_ROLE])
        else:
            headers = create_header_account(jwt, [role])
    else:
        if staff:
            headers = create_header(jwt, [role, STAFF_ROLE])
        else:
            headers = create_header(jwt, [role])

    # test
    rv = client.get(('/api/v1/party-codes/head-offices/' + search_value),
                    headers=headers)
    # check
    assert rv.status_code == status
    if rv.status_code == HTTPStatus.OK:
        if search_value != '8999':
            assert rv.json
            assert len(rv.json) == 4
        else:
            assert not rv.json
Example #8
0
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
Example #9
0
def test_amendment_valid_co_200(session, client, jwt):
    """Assert that a valid CO type amendment statement returns a 200 status."""
    # setup
    statement = copy.deepcopy(FINANCING_STATEMENT)
    statement['debtors'][0]['businessName'] = 'TEST BUS 2 DEBTOR'
    statement['type'] = 'SA'
    del statement['createDateTime']
    del statement['baseRegistrationNumber']
    del statement['payment']
    del statement['lifeInfinite']
    del statement['lienAmount']
    del statement['surrenderDate']
    del statement['documentId']

    rv1 = client.post('/api/v1/financing-statements',
                      json=statement,
                      headers=create_header_account(jwt, [PPR_ROLE]),
                      content_type='application/json')
    assert rv1.status_code == HTTPStatus.CREATED
    assert rv1.json['baseRegistrationNumber']
    base_reg_num = rv1.json['baseRegistrationNumber']

    json_data = copy.deepcopy(SAMPLE_JSON)
    json_data['baseRegistrationNumber'] = base_reg_num
    json_data['baseDebtor']['businessName'] = 'TEST BUS 2 DEBTOR'
    json_data['changeType'] = 'CO'
    del json_data['createDateTime']
    del json_data['amendmentRegistrationNumber']
    del json_data['payment']
    del json_data['removeTrustIndenture']
    del json_data['addTrustIndenture']
    del json_data['deleteDebtors']
    del json_data['documentId']
    json_data['deleteDebtors'] = rv1.json['debtors']
    del json_data['deleteSecuredParties']
    json_data['deleteSecuredParties'] = rv1.json['securedParties']
    del json_data['deleteGeneralCollateral']
    json_data['deleteGeneralCollateral'] = rv1.json['generalCollateral']
    del json_data['deleteVehicleCollateral']
    json_data['deleteVehicleCollateral'] = rv1.json['vehicleCollateral']
    #    print(json_data)

    # test
    rv = client.post('/api/v1/financing-statements/' + base_reg_num +
                     '/amendments',
                     json=json_data,
                     headers=create_header_account(jwt, [PPR_ROLE]),
                     content_type='application/json')

    # check
    #    print(rv.json)
    assert rv.status_code == HTTPStatus.OK
Example #10
0
def test_get_account_registrations_collapsed(session, client, jwt):
    """Assert that a request to get the collapsed list of registrations by account works as expected."""
    # setup

    # test
    response = client.get(
        '/api/v1/financing-statements/registrations?collapse=true',
        headers=create_header_account(jwt, [PPR_ROLE]))

    # check
    assert response.status_code == HTTPStatus.OK
    json_data = response.json
    assert json_data
    # print(json_data)
    assert len(json_data) > 0
    for statement in json_data:
        assert statement['registrationClass'] in ('PPSALIEN', 'MISCLIEN',
                                                  'CROWNLIEN')
        if statement['registrationNumber'] == 'TEST0001':
            assert statement['changes']
            for change in statement['changes']:
                assert change['baseRegistrationNumber'] == 'TEST0001'
                assert change['registrationClass'] not in ('PPSALIEN',
                                                           'MISCLIEN',
                                                           'CROWNLIEN')
Example #11
0
def test_renewal_sa_life_infinite(session, client, jwt):
    """Assert that a valid create renewal with infinite life returns a 201 status."""
    # setup
    current_app.config.update(PAYMENT_SVC_URL=MOCK_PAY_URL)
    rv1 = create_financing_test(session, client, jwt, 'SA')
    assert rv1.status_code == HTTPStatus.CREATED
    assert rv1.json['baseRegistrationNumber']
    base_reg_num = rv1.json['baseRegistrationNumber']

    json_data = copy.deepcopy(STATEMENT_VALID)
    json_data['baseRegistrationNumber'] = base_reg_num
    json_data['debtorName']['businessName'] = 'TEST BUS 2 DEBTOR'
    del json_data['payment']
    del json_data['lifeYears']
    json_data['lifeInfinite'] = True
    print(json_data)

    # test
    rv = client.post('/api/v1/financing-statements/' + base_reg_num +
                     '/renewals',
                     json=json_data,
                     headers=create_header_account(jwt, [PPR_ROLE]),
                     content_type='application/json')
    # check
    assert rv.status_code == HTTPStatus.CREATED
Example #12
0
def test_renewal_sa_success(session, client, jwt):
    """Assert that a valid create statement returns a 201 status."""
    # setup
    current_app.config.update(PAYMENT_SVC_URL=MOCK_PAY_URL)
    rv1 = create_financing_test(session, client, jwt, 'SA')
    assert rv1.status_code == HTTPStatus.CREATED
    assert rv1.json['baseRegistrationNumber']
    base_reg_num = rv1.json['baseRegistrationNumber']

    json_data = copy.deepcopy(STATEMENT_VALID)
    json_data['baseRegistrationNumber'] = base_reg_num
    json_data['debtorName']['businessName'] = 'TEST BUS 2 DEBTOR'
    del json_data['payment']

    # test
    rv = client.post('/api/v1/financing-statements/' + base_reg_num +
                     '/renewals',
                     json=json_data,
                     headers=create_header_account(jwt, [PPR_ROLE]),
                     content_type='application/json')
    # check
    assert rv.status_code == HTTPStatus.CREATED
    # basic verification statement data check
    json_data = rv.json
    assert 'renewalRegistrationNumber' in json_data
    assert len(json_data['changes']) >= 1
    assert 'renewalRegistrationNumber' in json_data['changes'][0]
    assert json_data['baseRegistrationNumber'] == base_reg_num
    assert json_data['changes'][0]['baseRegistrationNumber'] == base_reg_num
Example #13
0
def test_change_nonstaff_unauthorized_401(session, client, jwt):
    """Assert that a change statement request with a non-ppr role and account ID returns a 404 status."""
    # setup
    json_data = copy.deepcopy(SAMPLE_JSON)
    json_data['baseRegistrationNumber'] = 'TEST0001'
    json_data['baseDebtor']['businessName'] = 'TEST BUS 2 DEBTOR'
    json_data['changeType'] = 'AC'
    del json_data['createDateTime']
    del json_data['changeRegistrationNumber']
    del json_data['payment']
    del json_data['documentId']
    del json_data['addSecuredParties']
    del json_data['deleteSecuredParties']
    del json_data['deleteDebtors']
    del json_data['addDebtors']
    del json_data['deleteVehicleCollateral']
    del json_data['deleteGeneralCollateral']
    del json_data['addGeneralCollateral']

    # test
    rv = client.post('/api/v1/financing-statements/TEST0001/changes',
                     json=json_data,
                     headers=create_header_account(jwt, [COLIN_ROLE]),
                     content_type='application/json')

    # check
    assert rv.status_code == HTTPStatus.UNAUTHORIZED
Example #14
0
def test_change_create_invalid_type_400(session, client, jwt):
    """Assert that create statement with an invalid type returns a 400 error."""
    # setup
    json_data = copy.deepcopy(SAMPLE_JSON)
    json_data['baseRegistrationNumber'] = 'TEST0001'
    json_data['baseDebtor']['businessName'] = 'TEST BUS 2 DEBTOR'
    json_data['changeType'] = 'XX'
    del json_data['documentId']
    del json_data['createDateTime']
    del json_data['changeRegistrationNumber']
    del json_data['payment']
    del json_data['addSecuredParties']
    del json_data['deleteSecuredParties']
    del json_data['deleteDebtors']
    del json_data['addDebtors']
    del json_data['deleteVehicleCollateral']
    del json_data['deleteGeneralCollateral']
    del json_data['addGeneralCollateral']

    # test
    rv = client.post('/api/v1/financing-statements/TEST0001/changes',
                     json=json_data,
                     headers=create_header_account(jwt, [PPR_ROLE]),
                     content_type='application/json')
    # check
    assert rv.status_code == HTTPStatus.BAD_REQUEST
Example #15
0
def test_search_detail_staff_missing_account_400(session, client, jwt):
    """Assert that a search detail request with a staff jwt and no account ID returns a 400 status."""
    # setup
    current_app.config.update(PAYMENT_SVC_URL=MOCK_PAY_URL)
    json_data = {
        'type': 'REGISTRATION_NUMBER',
        'criteria': {
            'value': 'TEST0001'
        },
        'clientReferenceId': 'T-API-SD-RN-1'
    }

    # test
    rv1 = client.post('/api/v1/searches',
                      json=json_data,
                      headers=create_header_account(jwt, [PPR_ROLE],
                                                    'test-user', STAFF_ROLE),
                      content_type='application/json')
    assert rv1.status_code == HTTPStatus.CREATED

    search_id = rv1.json['searchId']
    json_data = rv1.json['results']

    # test
    rv = client.post('/api/v1/search-results/' + search_id,
                     json=json_data,
                     headers=create_header(jwt, [PPR_ROLE, STAFF_ROLE]),
                     content_type='application/json')

    # check
    assert rv.status_code == HTTPStatus.BAD_REQUEST
Example #16
0
def test_staff_search(session, client, jwt, role, routing_slip, bcol_number,
                      dat_number, certified, status):
    """Assert that staff search requests returns the correct status."""
    # setup
    current_app.config.update(PAYMENT_SVC_URL=MOCK_PAY_URL)
    params = ''
    if certified:
        params = '?certified=true'
    if routing_slip:
        if len(params) > 0:
            params += '&routingSlipNumber=' + str(routing_slip)
        else:
            params = '?routingSlipNumber=' + str(routing_slip)
    if bcol_number:
        if len(params) > 0:
            params += '&bcolAccountNumber=' + str(bcol_number)
        else:
            params = '?bcolAccountNumber=' + str(bcol_number)
    if dat_number:
        if len(params) > 0:
            params += '&datNumber=' + str(dat_number)
    print('params=' + params)
    rv = client.post('/api/v1/searches' + params,
                     json=REGISTRATION_NUMBER_JSON,
                     headers=create_header_account(jwt, [PPR_ROLE],
                                                   'test-user', role),
                     content_type='application/json')
    # check
    assert rv.status_code == status
Example #17
0
def test_create_renewal_staff(session, client, jwt, role, routing_slip,
                              bcol_number, dat_number, status):
    """Assert that a post renewal registration statement works as expected."""
    # setup
    current_app.config.update(PAYMENT_SVC_URL=MOCK_PAY_URL)
    json_data = copy.deepcopy(STATEMENT_VALID)
    params = ''
    if routing_slip:
        params = '?routingSlipNumber=' + str(routing_slip)
    elif bcol_number:
        params = '?bcolAccountNumber=' + str(bcol_number)
        if dat_number:
            params += '&datNumber=' + str(dat_number)
    # print('params=' + params)

    # test
    response = client.post(
        '/api/v1/financing-statements/TEST0001/renewals' + params,
        json=json_data,
        headers=create_header_account(jwt, [PPR_ROLE, role], 'test-user',
                                      role),
        content_type='application/json')

    # check
    assert response.status_code == status
Example #18
0
def test_search_detail_valid_200(session, client, jwt):
    """Assert that a valid search detail request returns a 200 status."""
    # setup
    current_app.config.update(PAYMENT_SVC_URL=MOCK_PAY_URL)
    json_data = {
        'type': 'BUSINESS_DEBTOR',
        'criteria': {
            'debtorName': {
                'business': 'TEST BUS 2 DEBTOR'
            }
        },
        'clientReferenceId': 'T-API-SQ-DB-2'
    }

    # test
    rv1 = client.post('/api/v1/searches',
                      json=json_data,
                      headers=create_header_account(jwt, [PPR_ROLE],
                                                    'test-user', STAFF_ROLE),
                      content_type='application/json')
    search_id = rv1.json['searchId']
    json_data = []
    count_exact = 0
    for result in rv1.json['results']:
        if result['matchType'] == 'SIMILAR':
            result['selected'] = False
        else:
            count_exact += 1
        json_data.append(result)

    # print(json_data)
    # test
    rv = client.post('/api/v1/search-results/' + search_id,
                     json=json_data,
                     headers=create_header_account(jwt, [PPR_ROLE]),
                     content_type='application/json')
    # check
    # print(rv.json)
    assert rv.status_code == HTTPStatus.OK
    results = rv.json
    assert 'searchDateTime' in results
    assert 'exactResultsSize' in results
    assert 'similarResultsSize' in results
    assert 'searchQuery' in results
    assert 'details' in results
    assert len(results['details']) == count_exact
Example #19
0
def test_financing_invalid_get_statement_404(session, client, jwt):
    """Assert that a get statement by invalid registration number returns a 404 status."""
    # setup

    # test
    rv = client.get('/api/v1/financing-statements/X12345X',
                    headers=create_header_account(jwt, [PPR_ROLE]))
    # check
    assert rv.status_code == HTTPStatus.NOT_FOUND
Example #20
0
def test_draft_get_list_200(session, client, jwt):
    """Assert that a get draft list for an account returns a 200 status."""
    # setup

    # test
    rv = client.get('/api/v1/drafts',
                    headers=create_header_account(jwt, [PPR_ROLE]))
    # check
    assert rv.status_code == HTTPStatus.OK
Example #21
0
def test_draft_invalid_get_statement_404(session, client, jwt):
    """Assert that a get draft by invalid document ID returns a 404 status."""
    # setup

    # test
    rv = client.get('/api/v1/drafts/D0012345',
                    headers=create_header_account(jwt, [PPR_ROLE]))
    # check
    assert rv.status_code == HTTPStatus.NOT_FOUND
Example #22
0
def test_draft_delete_404(session, client, jwt):
    """Assert that an invalid delete draft document ID returns a 404 status."""
    # setup

    # test
    rv = client.delete('/api/v1/drafts/X12345X',
                       headers=create_header_account(jwt, [PPR_ROLE]))
    # check
    assert rv.status_code == HTTPStatus.NOT_FOUND
Example #23
0
def test_draft_valid_get_statement_200(session, client, jwt):
    """Assert that a valid get draft by document ID returns a 200 status."""
    # setup

    # test
    rv = client.get('/api/v1/drafts/D-T-FS01',
                    headers=create_header_account(jwt, [PPR_ROLE]))
    # check
    assert rv.status_code == HTTPStatus.OK
Example #24
0
def test_financing_get_list_200(session, client, jwt):
    """Assert that a get financing statement summary list for an account returns a 200 status."""
    # setup

    # test
    rv = client.get('/api/v1/financing-statements',
                    headers=create_header_account(jwt, [PPR_ROLE]))
    # check
    assert rv.status_code == HTTPStatus.OK
Example #25
0
def test_draft_get_nonstaff_unauthorized_401(session, client, jwt):
    """Assert that a non-ppr role draft get request with an account ID returns a 404 status."""
    # setup

    # test
    rv = client.get('/api/v1/drafts/TEST-FSD1',
                    headers=create_header_account(jwt, [COLIN_ROLE]))
    # check
    assert rv.status_code == HTTPStatus.UNAUTHORIZED
Example #26
0
def test_financing_valid_get_statement_200(session, client, jwt):
    """Assert that a valid get financing statement by registration number returns a 200 status."""
    # setup

    # test
    rv = client.get('/api/v1/financing-statements/TEST0001',
                    headers=create_header_account(jwt, [PPR_ROLE]))
    # check
    assert rv.status_code == HTTPStatus.OK
Example #27
0
def test_search_history_valid_200(session, client, jwt):
    """Assert that valid search history account with some records returns a 200 status."""
    # no setup

    # test
    rv = client.get('/api/v1/search-history',
                    headers=create_header_account(jwt, [PPR_ROLE], 'test-user',
                                                  'PS12345'))
    # check
    assert rv.status_code == HTTPStatus.OK
Example #28
0
def test_search_valid(session, client, jwt, search_type, json_data):
    """Assert that valid search criteria returns a 201 status."""
    current_app.config.update(PAYMENT_SVC_URL=MOCK_PAY_URL)
    rv = client.post('/api/v1/searches',
                     json=json_data,
                     headers=create_header_account(jwt, [PPR_ROLE]),
                     content_type='application/json')
    # check
    assert rv.status_code == HTTPStatus.CREATED
    assert 'certified' not in rv.json['searchQuery']
Example #29
0
def test_financing_get_nonstaff_unauthorized_401(session, client, jwt):
    """Assert that a get financing statement request with a non-ppr role and account ID returns a 404 status."""
    # setup

    # test
    rv = client.get('/api/v1/financing-statements/TEST0001',
                    headers=create_header_account(jwt, [COLIN_ROLE]))

    # check
    assert rv.status_code == HTTPStatus.UNAUTHORIZED
Example #30
0
def test_discharge_success(session, client, jwt):
    """Assert that a valid create statement returns a 200 status."""
    # setup - create a financing statement as the base registration, then a discharge
    current_app.config.update(PAYMENT_SVC_URL=MOCK_PAY_URL)
    statement = copy.deepcopy(FINANCING_STATEMENT)
    statement['type'] = 'SA'
    statement['debtors'][0]['businessName'] = 'TEST BUS 2 DEBTOR'
    del statement['createDateTime']
    del statement['baseRegistrationNumber']
    del statement['payment']
    del statement['lifeInfinite']
    del statement['lienAmount']
    del statement['surrenderDate']
    del statement['documentId']

    rv1 = client.post('/api/v1/financing-statements',
                      json=statement,
                      headers=create_header_account(jwt, [PPR_ROLE]),
                      content_type='application/json')
    assert rv1.status_code == HTTPStatus.CREATED
    assert rv1.json['baseRegistrationNumber']
    base_reg_num = rv1.json['baseRegistrationNumber']

    json_data = copy.deepcopy(STATEMENT_VALID)
    json_data['debtorName']['businessName'] = 'TEST BUS 2 DEBTOR'
    json_data['baseRegistrationNumber'] = base_reg_num
    del json_data['payment']

    # test
    rv = client.post('/api/v1/financing-statements/' + base_reg_num +
                     '/discharges',
                     json=json_data,
                     headers=create_header_account(jwt, [PPR_ROLE]),
                     content_type='application/json')
    # check
    assert rv.status_code == HTTPStatus.CREATED
    # basic verification statement data check
    json_data = rv.json
    assert 'dischargeRegistrationNumber' in json_data
    assert len(json_data['changes']) >= 1
    assert 'dischargeRegistrationNumber' in json_data['changes'][0]
    assert json_data['baseRegistrationNumber'] == base_reg_num
    assert json_data['changes'][0]['baseRegistrationNumber'] == base_reg_num