11 # CubicWeb is distributed in the hope that it will be useful, but WITHOUT |
11 # CubicWeb is distributed in the hope that it will be useful, but WITHOUT |
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
13 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
13 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
14 # details. |
14 # details. |
15 # |
15 # |
16 # You should have received a copy of the GNU Lesser General Public License along |
16 # You should have received a copy of the GNU Lesser General Public License |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # along with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 """ |
18 """ |
19 |
19 |
20 """ |
20 """ |
21 from cubicweb.devtools.testlib import CubicWebTC |
21 from cubicweb.devtools.testlib import CubicWebTC |
22 from cubicweb.devtools.realdbtest import buildconfig, loadconfig |
22 from cubicweb.devtools.realdbtest import buildconfig, loadconfig |
|
23 |
23 |
24 |
24 def setUpModule(options): |
25 def setUpModule(options): |
25 if options.source: |
26 if options.source: |
26 configcls = loadconfig(options.source) |
27 configcls = loadconfig(options.source) |
27 elif options.dbname is None: |
28 elif options.dbname is None: |
28 raise Exception('either <sourcefile> or <dbname> options are required') |
29 raise Exception('either <sourcefile> or <dbname> options are required') |
29 else: |
30 else: |
30 configcls = buildconfig(options.dbuser, options.dbpassword, |
31 configcls = buildconfig(options.dbuser, options.dbpassword, |
31 options.dbname, options.euser, |
32 options.dbname, |
32 options.epassword) |
33 options.euser, options.epassword) |
33 RealDatabaseTC.configcls = configcls |
34 RealDatabaseTC.configcls = configcls |
34 |
35 |
35 |
36 |
36 class RealDatabaseTC(CubicWebTC): |
37 class RealDatabaseTC(CubicWebTC): |
37 configcls = None # set by setUpModule() |
38 configcls = None # set by setUpModule() |
38 |
39 |
39 def test_all_primaries(self): |
40 def test_all_primaries(self): |
40 for rset in self.iter_individual_rsets(limit=50): |
41 for rset in self.iter_individual_rsets(limit=50): |
41 yield self.view, 'primary', rset, rset.req.reset_headers() |
42 yield self.view, 'primary', rset, rset.req.reset_headers() |
42 |
43 |