test/unittest_repoapi.py
changeset 9062 fa5bc8aef7ed
parent 9061 e86fdab3d296
child 9658 c5b47406a15d
--- a/test/unittest_repoapi.py	Fri Jun 21 16:40:12 2013 +0200
+++ b/test/unittest_repoapi.py	Mon Jun 24 18:18:51 2013 +0200
@@ -21,7 +21,7 @@
 from cubicweb.devtools.testlib import CubicWebTC
 
 from cubicweb import ProgrammingError
-from cubicweb.repoapi import ClientConnection, connect
+from cubicweb.repoapi import ClientConnection, connect, anonymous_cnx
 
 
 class REPOAPITC(CubicWebTC):
@@ -74,6 +74,15 @@
             rset = clt_cnx.execute('Any X WHERE X is CWUser')
             self.assertTrue(rset)
 
+    def test_anonymous_connect(self):
+        """check that you can get anonymous connection when the data exist"""
+
+        clt_cnx = anonymous_cnx(self.repo)
+        self.assertEqual('anon', clt_cnx.user.login)
+        with clt_cnx:
+            rset = clt_cnx.execute('Any X WHERE X is CWUser')
+            self.assertTrue(rset)
 
 
 
+