Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vysakh-menon-aot committed Nov 4, 2024
1 parent a154ba9 commit 74d5f18
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ def get(status=None):

if status is None:
pending_filings = Filing.get_completed_filings_for_colin()
for filing in pending_filings.get('filings'):
for filing in pending_filings:
filing_json = filing.filing_json
business = Business.find_by_internal_id(filing.business_id)
if filing_json and filing.filing_type != 'lear_epoch' and \
Expand Down
3 changes: 0 additions & 3 deletions legal-api/tests/unit/models/test_filing.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,6 @@ def test_get_internal_filings(session, client, jwt):
filing.colin_event_ids.append(colin_event_id)
filing.save()
filings = Filing.get_completed_filings_for_colin()
filings = filings.get('filings')

# test method
# assert doesn't return completed filing with colin_event_ids set
Expand All @@ -550,7 +549,6 @@ def test_get_internal_filings(session, client, jwt):
filing.colin_event_ids.clear()
filing.save()
filings = Filing.get_completed_filings_for_colin()
filings = filings.get('filings')
assert len(filings) == 1
assert filing.id == filings[0].json['filing']['header']['filingId']
assert filings[0].json['filing']['header']['colinIds'] == []
Expand All @@ -559,7 +557,6 @@ def test_get_internal_filings(session, client, jwt):
filing.save()
assert filing.status != Filing.Status.COMPLETED.value
filings = Filing.get_completed_filings_for_colin()
filings = filings.get('filings')
assert len(filings) == 0


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,31 +279,6 @@ def test_get_internal_filings(session, client, jwt):
assert rv.json[0]['filingId'] == filing1.id


@pytest.mark.parametrize('identifier, base_filing, corrected_filing, colin_id', [
('BC1234567', CORRECTION_INCORPORATION, INCORPORATION_FILING_TEMPLATE, 1234),
('BC1234568', CORRECTION_INCORPORATION, INCORPORATION_FILING_TEMPLATE, None),
])
def test_get_bcomp_corrections(session, client, jwt, identifier, base_filing, corrected_filing, colin_id):
"""Assert that the internal filings get endpoint returns corrections for bcomps."""
# setup
b = factory_business(identifier=identifier, entity_type=Business.LegalTypes.BCOMP.value)
factory_business_mailing_address(b)

incorp_filing = factory_completed_filing(business=b, data_dict=corrected_filing, colin_id=colin_id)
correction_filing = copy.deepcopy(base_filing)
correction_filing['filing']['correction']['correctedFilingId'] = incorp_filing.id
filing = factory_completed_filing(b, correction_filing)

# test endpoint returns filing
rv = client.get('/api/v1/businesses/internal/filings')
assert rv.status_code == HTTPStatus.OK
assert len(rv.json) == 1
if colin_id:
assert rv.json[0]['filingId'] == filing.id
else:
assert rv.json[0]['filingId'] == incorp_filing.id


def test_patch_internal_filings(session, client, jwt):
"""Assert that the internal filings patch endpoint updates the colin_event_id."""
from legal_api.models.colin_event_id import ColinEventId
Expand Down
27 changes: 0 additions & 27 deletions legal-api/tests/unit/resources/v2/test_colin_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,33 +79,6 @@ def test_get_internal_filings(session, client, jwt):
assert filings[0]['filingId'] == filing1.id


@pytest.mark.parametrize('identifier, base_filing, corrected_filing, colin_id', [
('BC1234567', CORRECTION_INCORPORATION, INCORPORATION_FILING_TEMPLATE, 1234),
('BC1234568', CORRECTION_INCORPORATION, INCORPORATION_FILING_TEMPLATE, None),
])
def test_get_bcomp_corrections(session, client, jwt, identifier, base_filing, corrected_filing, colin_id):
"""Assert that the internal filings get endpoint returns corrections for bcomps."""
# setup
b = factory_business(identifier=identifier, entity_type=Business.LegalTypes.BCOMP.value)
factory_business_mailing_address(b)

incorp_filing = factory_completed_filing(business=b, data_dict=corrected_filing, colin_id=colin_id)
correction_filing = copy.deepcopy(base_filing)
correction_filing['filing']['correction']['correctedFilingId'] = incorp_filing.id
filing = factory_completed_filing(b, correction_filing)

# test endpoint returns filing
rv = client.get('/api/v2/businesses/internal/filings',
headers=create_header(jwt, [COLIN_SVC_ROLE]))
assert rv.status_code == HTTPStatus.OK
filings = rv.json.get('filings')
assert len(filings) == 1
if colin_id:
assert filings[0]['filingId'] == filing.id
else:
assert filings[0]['filingId'] == incorp_filing.id


def test_patch_internal_filings(session, client, jwt):
"""Assert that the internal filings patch endpoint updates the colin_event_id."""
from legal_api.models.colin_event_id import ColinEventId
Expand Down

0 comments on commit 74d5f18

Please sign in to comment.