equal
deleted
inserted
replaced
22 import os |
22 import os |
23 from cStringIO import StringIO |
23 from cStringIO import StringIO |
24 from logilab.common.testlib import TestCase, unittest_main |
24 from logilab.common.testlib import TestCase, unittest_main |
25 |
25 |
26 from cubicweb.cwconfig import CubicWebConfiguration |
26 from cubicweb.cwconfig import CubicWebConfiguration |
|
27 from cubicweb.devtools.testlib import CubicWebTC |
|
28 from cubicweb.server.migractions import ServerMigrationHelper |
|
29 |
27 CubicWebConfiguration.load_cwctl_plugins() # XXX necessary? |
30 CubicWebConfiguration.load_cwctl_plugins() # XXX necessary? |
|
31 |
28 |
32 |
29 class CubicWebCtlTC(TestCase): |
33 class CubicWebCtlTC(TestCase): |
30 def setUp(self): |
34 def setUp(self): |
31 self.stream = StringIO() |
35 self.stream = StringIO() |
32 sys.stdout = self.stream |
36 sys.stdout = self.stream |
35 |
39 |
36 def test_list(self): |
40 def test_list(self): |
37 from cubicweb.cwctl import ListCommand |
41 from cubicweb.cwctl import ListCommand |
38 ListCommand().run([]) |
42 ListCommand().run([]) |
39 |
43 |
|
44 |
|
45 class CubicWebShellTC(CubicWebTC): |
|
46 |
|
47 def test_process_script_args_context(self): |
|
48 repo = self.cnx._repo |
|
49 mih = ServerMigrationHelper(None, repo=repo, cnx=self.cnx, |
|
50 interactive=False, |
|
51 # hack so it don't try to load fs schema |
|
52 schema=1) |
|
53 scripts = {'script1.py': list(), |
|
54 'script2.py': ['-v'], |
|
55 'script3.py': ['-vd', '-f', 'FILE.TXT'], |
|
56 } |
|
57 mih.cmd_process_script('data/scripts/script1.py', funcname=None) |
|
58 for script, args in scripts.items(): |
|
59 scriptname = os.path.join('data/scripts/', script) |
|
60 self.assert_(os.path.exists(scriptname)) |
|
61 mih.cmd_process_script(scriptname, None, args=args) |
|
62 |
|
63 |
40 if __name__ == '__main__': |
64 if __name__ == '__main__': |
41 unittest_main() |
65 unittest_main() |