def test_as_fhir(self): org = Organization(name='Homer\'s Hospital') org.use_specific_codings = True org.race_codings = False data = org.as_fhir() self.assertEquals(org.name, data['name']) self.assertTrue(data['use_specific_codings']) self.assertFalse(data['race_codings'])
def test_as_fhir(self): org = Organization(name='Homer\'s Hospital') org.use_specific_codings = True org.race_codings = False data = org.as_fhir() assert org.name == data['name'] assert data['use_specific_codings'] assert not data['race_codings']
def test_as_fhir(self): org = Organization(name='Homer\'s Hospital') org.use_specific_codings = True org.race_codings = False data = org.as_fhir() assert org.name == data['name'] assert data['use_specific_codings'] assert not data['race_codings']
def test_locale_inheritance(self): # prepopuate database with matching locale cd = Coding.from_fhir({'code': 'en_AU', 'display': 'Australian English', 'system': "urn:ietf:bcp:47"}) # create parent with locale parent_id = 101 parent = Organization(id=parent_id, name='test parent') ol = OrganizationLocale(organization_id=parent_id, coding_id=cd.id) # create child org with no locales org = Organization(id=102, name='test', partOf_id=parent_id) org.use_specific_codings = False with SessionScope(db): db.session.add(parent) db.session.commit() db.session.add(ol) db.session.add(org) db.session.commit() org = db.session.merge(org) self.assertEquals(org.partOf_id, parent_id) # add child org to user user = User.query.get(TEST_USER_ID) user.organizations.append(org) # test locale inheritance self.assertEquals(user.locale_display_options,set(['en_AU']))