def test_business_json(): """Assert that the business model is saved correctly.""" epoch_date = datetime.utcfromtimestamp(0) business = Business(legal_name='legal_name', founding_date=epoch_date, identifier='CP1234567', last_modified=epoch_date) d = { 'legalName': 'legal_name', 'identifier': 'CP1234567', 'foundingDate': epoch_date.isoformat(), 'lastModified': epoch_date.isoformat(), } assert business.json() == d business.dissolution_date = epoch_date d['dissolutionDate'] = datetime.date(business.dissolution_date).isoformat() assert business.json() == d business.dissolution_date = None d.pop('dissolutionDate') business.fiscal_year_end_date = epoch_date d['fiscalYearEndDate'] = datetime.date( business.fiscal_year_end_date).isoformat() assert business.json() == d business.fiscal_year_end_date = None d.pop('fiscalYearEndDate') business.tax_id = '123456789' d['taxId'] = business.tax_id assert business.json() == d business.tax_id = None d.pop('taxId')
def test_business_json(session): """Assert that the business model is saved correctly.""" business = Business(legal_name='legal_name', legal_type='CP', founding_date=EPOCH_DATETIME, last_ledger_timestamp=EPOCH_DATETIME, identifier='CP1234567', last_modified=EPOCH_DATETIME, last_ar_date=EPOCH_DATETIME, last_agm_date=EPOCH_DATETIME, restriction_ind=True) # basic json d = { 'legalName': 'legal_name', 'legalType': 'CP', 'identifier': 'CP1234567', 'foundingDate': EPOCH_DATETIME.isoformat(), 'lastAddressChangeDate': '', 'lastDirectorChangeDate': '', 'lastLedgerTimestamp': EPOCH_DATETIME.isoformat(), 'lastModified': EPOCH_DATETIME.isoformat(), 'lastAnnualReportDate': datetime.date(EPOCH_DATETIME).isoformat(), 'lastAnnualGeneralMeetingDate': datetime.date(EPOCH_DATETIME).isoformat(), 'nextAnnualReport': '1971-01-01T08:00:00+00:00', 'hasRestrictions': True, 'goodStanding': False, # good standing will be false because the epoch is 1970 'arMinDate': '1971-01-01', 'arMaxDate': '1972-04-30' } assert business.json() == d # include dissolutionDate business.dissolution_date = EPOCH_DATETIME d['dissolutionDate'] = datetime.date(business.dissolution_date).isoformat() assert business.json() == d business.dissolution_date = None d.pop('dissolutionDate') # include fiscalYearEndDate business.fiscal_year_end_date = EPOCH_DATETIME d['fiscalYearEndDate'] = datetime.date( business.fiscal_year_end_date).isoformat() assert business.json() == d business.fiscal_year_end_date = None d.pop('fiscalYearEndDate') # include taxId business.tax_id = '123456789' d['taxId'] = business.tax_id assert business.json() == d business.tax_id = None d.pop('taxId')
def test_business_json(session): """Assert that the business model is saved correctly.""" business = Business( legal_name='legal_name', legal_type='CP', founding_date=EPOCH_DATETIME, last_ledger_timestamp=EPOCH_DATETIME, identifier='CP1234567', last_modified=EPOCH_DATETIME, last_ar_date=EPOCH_DATETIME, last_agm_date=EPOCH_DATETIME, ) # basic json d = { 'legalName': 'legal_name', 'legalType': 'CP', 'identifier': 'CP1234567', 'foundingDate': EPOCH_DATETIME.isoformat(), 'lastLedgerTimestamp': EPOCH_DATETIME.isoformat(), 'lastModified': EPOCH_DATETIME.isoformat(), 'lastAnnualReport': datetime.date(EPOCH_DATETIME).isoformat(), 'lastAnnualGeneralMeetingDate': datetime.date(EPOCH_DATETIME).isoformat(), 'nextAnnualReport': (EPOCH_DATETIME + datedelta.YEAR).isoformat() } assert business.json() == d # include dissolutionDate business.dissolution_date = EPOCH_DATETIME d['dissolutionDate'] = datetime.date(business.dissolution_date).isoformat() assert business.json() == d business.dissolution_date = None d.pop('dissolutionDate') # include fiscalYearEndDate business.fiscal_year_end_date = EPOCH_DATETIME d['fiscalYearEndDate'] = datetime.date( business.fiscal_year_end_date).isoformat() assert business.json() == d business.fiscal_year_end_date = None d.pop('fiscalYearEndDate') # include taxId business.tax_id = '123456789' d['taxId'] = business.tax_id assert business.json() == d business.tax_id = None d.pop('taxId')