def test_view_with_more_entities(self): # Test the view for an entry that has # entities for more dimensions than to and from from openspending.logic.entry import entitify_entry entry = model.Entry.find_one() # use the existing 'pog' dimensions and stuff a ref to an entity # in there. pog_entity = model.Entity(name='pog-entity', label='Test Pog Entity') pog_entity.save() entitify_entry(entry, pog_entity, 'pog') entry.save() response = self.app.get(url(controller='entry', action='view', id=str(entry.id), name=entry['name'])) assert 'Test Pog Entity' in response
def entitify_entry(self, entry, entity, name): '''\ Update the *entry* to use the *entity* for the dimension *name*. ``entry`` A ``dict`` like object, e.g. an instance of :class:`openspending.model.Base`. ``entity`` A :class:`openspending.model.entity` object ``name`` This is the key where the value of the entity will be saved. return:``None`` ''' entitify_entry(entry, entity, name)