Skip to content

Commit

Permalink
24982 - update tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
hfekete committed Jan 30, 2025
1 parent a2db5be commit 94d723a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"businessIdentifier": "BC1230113",
"effectiveDate": "2024-09-16",
"filingType": "INITIAL_FILING",
"entityStatement": {
"entityType": "legalEntity",
"identifiers": [],
Expand Down
22 changes: 15 additions & 7 deletions btr-api/tests/unit/resources/test_submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ def verify_text_in_email(text: str):
email_verified = True
break
assert email_verified




@pytest.mark.parametrize(
Expand Down Expand Up @@ -223,7 +223,7 @@ def test_post_plots_db_mocked(app, session, client, jwt, mocker, requests_mock):
bor_api_mock = requests_mock.put(
f"{app.config.get('BOR_SVC_URL')}/internal/solr/update", json={'message': 'Update accepted'}
)

email_mock = requests_mock.post(f"{app.config.get('NOTIFY_SVC_URL')}", json={})
mock_user_save = mocker.patch.object(UserModel, 'save')
mock_submission_save = mocker.patch.object(SubmissionModel, 'save')
Expand Down Expand Up @@ -280,12 +280,19 @@ def mocked_to_dict(submission: SubmissionModel):
assert bor_api_mock.called == True
assert auth_api_entity_contact_mock.called == True
assert email_mock.called == True
print('*' * 80)
print('*' * 80)
print('*' * 80)
print(pay_api_mock.request_history[0].json)
print('*' * 80)
print('*' * 80)
print('*' * 80)
assert pay_api_mock.request_history[0].json() == {
'filingInfo': {'filingTypes': [{'filingTypeCode': 'REGSIGIN'}]},
'businessInfo': {'corpType': 'BTR', 'businessIdentifier': json_data['businessIdentifier']},
'details': [{'label': 'Incorporation Number: ', 'value': json_data['businessIdentifier']}],
}

assert bor_api_mock.request_history[0].json() == {
'business': {
'addresses': [mocked_entity_address_response['deliveryAddress']],
Expand Down Expand Up @@ -474,6 +481,7 @@ def test_put_plots(app, client, session, jwt, requests_mock):
put_data = {
'businessIdentifier': identifier,
'effectiveDate': '2024-09-23',
'filingType': 'INITIAL_FILING',
'entityStatement': {
'entityType': 'legalEntity',
'identifiers': [],
Expand Down Expand Up @@ -539,7 +547,7 @@ def test_put_plots(app, client, session, jwt, requests_mock):
assert updated_submission.business_identifier == json_data['businessIdentifier']
# check pay link
assert updated_submission.invoice_id == mocked_invoice_id

# Check name changed
assert updated_submission.person_statements_json[0]['names'][0]['fullName'] == json_data['personStatements'][0]['names'][0]['fullName']

Expand All @@ -551,7 +559,7 @@ def test_put_plots(app, client, session, jwt, requests_mock):
assert bor_api_mock.called == True
assert auth_api_entity_contact_mock.called == True
assert email_mock.called == True




Expand Down Expand Up @@ -898,7 +906,7 @@ def test_get_latest_for_entity(app, client, session, jwt, requests_mock, sample_
}],
'personStatements': s1.person_statements_json
}

(SubmissionService.create_submission(s2_dict, sample_user.id)).save()
(SubmissionService.create_submission(s3_dict, sample_user.id)).save()
mock_account_id = 1
Expand Down

0 comments on commit 94d723a

Please sign in to comment.