@@ -0,0 +1,1299 @@
+%22%22%22Tests for vumi.scripts.db_backup.%22%22%22%0A%0Afrom twisted.trial.unittest import TestCase%0A%0Afrom vumi.tests.utils import PersistenceMixin%0A%0Afrom vumi.scripts.db_backup import ConfigHolder, Options%0A%0A%0Aclass TestConfigHolder(ConfigHolder):%0A    def __init__(self, *args, **kwargs):%0A        self.output = %5B%5D%0A        super(TestConfigHolder, self).__init__(*args, **kwargs)%0A%0A    def emit(self, s):%0A        self.output.append(s)%0A%0A%0Adef make_cfg(args):%0A    options = Options()%0A    options.parseOptions(args)%0A    return TestConfigHolder(options)%0A%0A%0Aclass DbBackupBaseTestCase(TestCase, PersistenceMixin):%0A    sync_persistence = True%0A%0A    def setUp(self):%0A        self._persist_setUp()%0A        # Make sure we start fresh.%0A        self.get_redis_manager()._purge_all()%0A%0A    def tearDown(self):%0A        return self._persist_tearDown()%0A%0A%0Aclass BackupDbCmdTestCase(DbBackupBaseTestCase):%0A    def test_backup_db(self):%0A        cfg = make_cfg(%5B%22backup%22, %22db_config.yaml%22%5D)%0A        cfg.run()%0A        self.assertEqual(cfg.output, %5B%0A            'Backing up dbs ...',%0A        %5D)%0A%0A%0Aclass RestoreDbCmdTestCase(DbBackupBaseTestCase):%0A    def test_create_pool_range_tags(self):%0A        cfg = make_cfg(%5B%22restore%22, %22db_backup.json%22%5D)%0A        cfg.run()%0A        self.assertEqual(cfg.output, %5B%0A            'Restoring dbs ...',%0A        %5D)%0A

Test skeleton for db backup scripts.