def test_302_with_wrong_slug(self): from webob.exc import HTTPMovedPermanently from openspending.ui.controllers.entity import EntityController entity = self._make_one(name='Test Entity') controller = EntityController() h.assert_raises(HTTPMovedPermanently, controller.view, id=str(entity['_id']), slug='wrong-slug')
def test_404_with_name(self): from webob.exc import HTTPNotFound from openspending.ui.controllers.entity import EntityController entity = self._make_one(name='Test Entity') controller = EntityController() h.assert_raises(HTTPNotFound, controller.view, id=entity['name'], slug='dontcare')
def test_404_with_wrong_objectid(self): from bson import ObjectId from webob.exc import HTTPNotFound from openspending.ui.controllers.entity import EntityController entity = self._make_one(name='Test Entity') controller = EntityController() other_objectid = ObjectId() h.assert_not_equal(entity['_id'], other_objectid) h.assert_raises(HTTPNotFound, controller.view, id=str(other_objectid), slug='dontcare')