[routes] Add a 'cwentities' route with traversal
The route uses a factory that produces ETypeResource and EntityResource as
a context.
A 'delete' view serve as a test and demonstration.
The module being experimental, it has to be explicitely included.
from __future__ import absolute_import
from . import PyramidCWTest
class EntitiesTest(PyramidCWTest):
def includeme(self, config):
config.include('pyramid_cubicweb.entities')
def test_delete(self):
with self.admin_access.repo_cnx() as cnx:
cnx.create_entity('CWGroup', name=u'tmp')
cnx.commit()
self.login()
res = self.webapp.delete('/cwgroup/tmp')
self.assertEqual(res.status_int, 204)
with self.admin_access.repo_cnx() as cnx:
self.assertEqual(cnx.find('CWGroup', name=u'tmp').rowcount, 0)