cubicweb/server/test/unittest_serverctl.py
changeset 11057 0b59724cb3f2
parent 10960 9e64fddebc89
child 11269 73ac69970047
equal deleted inserted replaced
11052:058bb3dc685f 11057:0b59724cb3f2
       
     1 import os.path as osp
       
     2 import shutil
       
     3 
       
     4 from cubicweb.devtools import testlib, ApptestConfiguration
       
     5 from cubicweb.server.serverctl import _local_dump, DBDumpCommand
       
     6 from cubicweb.server.serverconfig import ServerConfiguration
       
     7 
       
     8 class ServerCTLTC(testlib.CubicWebTC):
       
     9     def setUp(self):
       
    10         super(ServerCTLTC, self).setUp()
       
    11         self.orig_config_for = ServerConfiguration.config_for
       
    12         config_for = lambda appid: ApptestConfiguration(appid, apphome=self.datadir)
       
    13         ServerConfiguration.config_for = staticmethod(config_for)
       
    14 
       
    15     def tearDown(self):
       
    16         ServerConfiguration.config_for = self.orig_config_for
       
    17         super(ServerCTLTC, self).tearDown()
       
    18 
       
    19     def test_dump(self):
       
    20         DBDumpCommand(None).run([self.appid])
       
    21         shutil.rmtree(osp.join(self.config.apphome, 'backup'))
       
    22 
       
    23 
       
    24 if __name__ == '__main__':
       
    25     from unittest import main
       
    26     main()