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 |
24 from cubicweb.repoapi import ClientConnection, connect |
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): |
64 cltcnx.execute('Any X WHERE X is CWUser') |
64 cltcnx.execute('Any X WHERE X is CWUser') |
65 # connection closed |
65 # connection closed |
66 with self.assertRaises(ProgrammingError): |
66 with self.assertRaises(ProgrammingError): |
67 cltcnx.execute('Any X WHERE X is CWUser') |
67 cltcnx.execute('Any X WHERE X is CWUser') |
68 |
68 |
|
69 def test_connect(self): |
|
70 """check that repoapi.connect works and return a usable connection""" |
|
71 clt_cnx = connect(self.repo, login='admin', password='gingkow') |
|
72 self.assertEqual('admin', clt_cnx.user.login) |
|
73 with clt_cnx: |
|
74 rset = clt_cnx.execute('Any X WHERE X is CWUser') |
|
75 self.assertTrue(rset) |
69 |
76 |
70 |
77 |
|
78 |
|
79 |