[server/test] convert new test to 3.19 API 3.19.8 centos/3.19.8-1 cubicweb-centos-version-3.19.8-1 cubicweb-debian-version-3.19.8-1 cubicweb-version-3.19.8 debian/3.19.8-1
authorJulien Cristau <julien.cristau@logilab.fr>
Thu, 22 Jan 2015 17:22:09 +0100
changeset 10158 efc8645ece43
parent 10157 ca3c145fd08b
child 10159 5cc8fdba56d5
[server/test] convert new test to 3.19 API
server/test/unittest_security.py
--- a/server/test/unittest_security.py	Thu Jan 22 17:18:55 2015 +0100
+++ b/server/test/unittest_security.py	Thu Jan 22 17:22:09 2015 +0100
@@ -117,12 +117,12 @@
             self.assertEqual(cnx.execute('Personne X').rowcount, 1)
 
     def test_insert_security_2(self):
-        with self.login('anon') as cu:
-            cu.execute("INSERT Affaire X")
-            self.assertRaises(Unauthorized, self.commit)
+        with self.new_access('anon').repo_cnx() as cnx:
+            cnx.execute("INSERT Affaire X")
+            self.assertRaises(Unauthorized, cnx.commit)
             # anon has no read permission on Affaire entities, so
             # rowcount == 0
-            self.assertEqual(cu.execute('Affaire X').rowcount, 0)
+            self.assertEqual(cnx.execute('Affaire X').rowcount, 0)
 
     def test_insert_rql_permission(self):
         # test user can only add une affaire related to a societe he owns