author | Rabah Meradi <rabah.meradi@logilab.fr> |
Thu, 27 Aug 2015 11:25:42 +0200 | |
changeset 11597 | 286611d1d7a4 |
parent 11596 | pyramid_cubicweb/tests/test_entities.py@1f2570f1d72a |
child 11598 | 2dc0b0db2329 |
permissions | -rw-r--r-- |
11596
1f2570f1d72a
[routes] Add a 'cwentities' route with traversal
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
1 |
from __future__ import absolute_import |
1f2570f1d72a
[routes] Add a 'cwentities' route with traversal
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
2 |
|
1f2570f1d72a
[routes] Add a 'cwentities' route with traversal
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
3 |
from . import PyramidCWTest |
1f2570f1d72a
[routes] Add a 'cwentities' route with traversal
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
4 |
|
1f2570f1d72a
[routes] Add a 'cwentities' route with traversal
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
5 |
|
11597
286611d1d7a4
[views] Rename entities to rest_api
Rabah Meradi <rabah.meradi@logilab.fr>
parents:
11596
diff
changeset
|
6 |
class RestApiTest(PyramidCWTest): |
11596
1f2570f1d72a
[routes] Add a 'cwentities' route with traversal
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
7 |
def includeme(self, config): |
11597
286611d1d7a4
[views] Rename entities to rest_api
Rabah Meradi <rabah.meradi@logilab.fr>
parents:
11596
diff
changeset
|
8 |
config.include('pyramid_cubicweb.rest_api') |
11596
1f2570f1d72a
[routes] Add a 'cwentities' route with traversal
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
9 |
|
1f2570f1d72a
[routes] Add a 'cwentities' route with traversal
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
10 |
def test_delete(self): |
1f2570f1d72a
[routes] Add a 'cwentities' route with traversal
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
11 |
with self.admin_access.repo_cnx() as cnx: |
1f2570f1d72a
[routes] Add a 'cwentities' route with traversal
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
12 |
cnx.create_entity('CWGroup', name=u'tmp') |
1f2570f1d72a
[routes] Add a 'cwentities' route with traversal
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
13 |
cnx.commit() |
1f2570f1d72a
[routes] Add a 'cwentities' route with traversal
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
14 |
|
1f2570f1d72a
[routes] Add a 'cwentities' route with traversal
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
15 |
self.login() |
1f2570f1d72a
[routes] Add a 'cwentities' route with traversal
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
16 |
res = self.webapp.delete('/cwgroup/tmp') |
1f2570f1d72a
[routes] Add a 'cwentities' route with traversal
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
17 |
self.assertEqual(res.status_int, 204) |
1f2570f1d72a
[routes] Add a 'cwentities' route with traversal
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
18 |
|
1f2570f1d72a
[routes] Add a 'cwentities' route with traversal
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
19 |
with self.admin_access.repo_cnx() as cnx: |
1f2570f1d72a
[routes] Add a 'cwentities' route with traversal
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
20 |
self.assertEqual(cnx.find('CWGroup', name=u'tmp').rowcount, 0) |