equal
deleted
inserted
replaced
19 |
19 |
20 |
20 |
21 from cubicweb.devtools.testlib import CubicWebTC |
21 from cubicweb.devtools.testlib import CubicWebTC |
22 |
22 |
23 from cubicweb import ProgrammingError |
23 from cubicweb import ProgrammingError |
24 from cubicweb.repoapi import ClientConnection, connect, anonymous_cnx |
24 from cubicweb.repoapi import Connection, connect, anonymous_cnx |
25 |
25 |
26 |
26 |
27 class REPOAPITC(CubicWebTC): |
27 class REPOAPITC(CubicWebTC): |
28 |
28 |
29 def test_clt_cnx_basic_usage(self): |
29 def test_clt_cnx_basic_usage(self): |
54 |
54 |
55 def test_clt_cnx_life_cycle(self): |
55 def test_clt_cnx_life_cycle(self): |
56 """Check that ClientConnection requires explicit open and close |
56 """Check that ClientConnection requires explicit open and close |
57 """ |
57 """ |
58 access = self.admin_access |
58 access = self.admin_access |
59 cltcnx = ClientConnection(access._session) |
59 cltcnx = Connection(access._session) |
60 # connection not open yet |
60 # connection not open yet |
61 with self.assertRaises(ProgrammingError): |
61 with self.assertRaises(ProgrammingError): |
62 cltcnx.execute('Any X WHERE X is CWUser') |
62 cltcnx.execute('Any X WHERE X is CWUser') |
63 # connection open and working |
63 # connection open and working |
64 with cltcnx: |
64 with cltcnx: |