Exemple #1
0
def test_get_legal_filings():
    """Assert that the legal_filings member returns valid JSON Legal Filing segments."""
    filing = Filing()

    assert not filing.legal_filings()

    filing.filing_json = ANNUAL_REPORT
    legal_filings = filing.legal_filings()

    assert legal_filings
    assert 'annualReport' in legal_filings[0].keys()
Exemple #2
0
def process(correction_filing: Filing, filing: Dict):
    """Render the correction filing onto the business model objects."""
    local_timezone = pytz.timezone('US/Pacific')

    # link to original filing
    original_filing = Filing.find_by_id(
        filing['correction']['correctedFilingId'])
    original_filing.parent_filing = correction_filing

    # add comment to the original filing
    original_filing.comments.append(
        Comment(
            comment=f'This filing was corrected on '
            f'{correction_filing.filing_date.astimezone(local_timezone).date().isoformat()}.',
            staff_id=correction_filing.submitter_id))

    # add comment to the correction filing
    correction_filing.comments.append(
        Comment(comment=filing['correction']['comment'],
                staff_id=correction_filing.submitter_id))
    if not any('incorporationApplication' in x
               for x in correction_filing.legal_filings()):
        # set correction filing to PENDING_CORRECTION, for manual intervention
        # - include flag so that listener in Filing model does not change state automatically to COMPLETE
        correction_filing._status = Filing.Status.PENDING_CORRECTION.value  # pylint: disable=protected-access
        setattr(correction_filing, 'skip_status_listener', True)

    original_filing.save_to_session()
    return correction_filing