def test_filing_json_draft(session): """Assert that the json field gets the draft filing correctly.""" filing = Filing() filing_submission = { 'filing': { 'header': { 'name': 'specialResolution', 'date': '2019-04-08' }, 'specialResolution': { 'resolution': 'Year challenge is hitting oppo for the win.' }}} filing.json = filing_submission filing.save() assert filing.json == filing_submission
def test_technical_filing_json_draft(session): """Assert that the technical json field gets the draft filing correctly. technical filings should bypass all checks. danger Will Robinson This builds on test_filing_json_draft, so if that is broken, this wont work either. """ # setup filing = Filing() filing_submission = { 'filing': { 'header': { 'name': 'specialResolution', 'date': '2019-04-08' }, 'specialResolution': { 'resolution': 'Year challenge is hitting oppo for the win.' } } } filing.json = filing_submission filing.save() # sanity check assert filing.json['filing']['header']['name'] == filing_submission[ 'filing']['header']['name'] assert filing.json['filing']['specialResolution'] == filing_submission[ 'filing']['specialResolution'] # test non_compliant_json = { 'dope': 'this would fail any validator, but can bypass everything.', 'dogsLife': "do the humans really know what's best?" } filing.storage.tech_correction_json = non_compliant_json # over ride the state and skip state setting listeners for this test filing._storage.skip_status_listener = True filing._storage._status = Filing.Status.PENDING.value filing.save() # validate assert filing.json == non_compliant_json
def test_filing_save(session): """Assert that the core filing is saved to the backing store.""" filing = Filing() filing_submission = { 'filing': { 'header': { 'name': 'specialResolution', 'date': '2019-04-08' }, 'specialResolution': { 'resolution': 'Year challenge is hitting oppo for the win.' }}} filing.json = filing_submission assert not filing.id filing.save() assert filing.id
def test_set_effective(session): """Assert that the core filing is saved to the backing store.""" now = datetime(2021, 9, 17, 7, 36, 43, 903557, tzinfo=timezone.utc) with freeze_time(now): payment_date = now + datedelta.DAY filing = Filing() filing_type = 'annualReport' filing.json = ANNUAL_REPORT filing.save() filing.storage._payment_token = '12345' filing.storage._filing_type = filing_type filing.storage.effective_date = now filing._storage.skip_status_listener = True filing._storage.payment_completion_date = payment_date filing._storage.save() filing.storage.set_processed() # assert that the effective date is the payment date assert filing._storage.effective_date assert filing._storage.effective_date.replace( tzinfo=None) == payment_date.replace(tzinfo=None) assert not filing.is_future_effective future_date = now + datedelta.DAY alt_payment_date = now filing._storage.skip_status_listener = True filing._storage.payment_completion_date = alt_payment_date filing._storage.save() filing.storage.set_processed() # assert that the effective date is the future date assert filing._storage.effective_date assert filing._storage.effective_date.replace( tzinfo=None) == future_date.replace(tzinfo=None) assert filing.is_future_effective