def test_execute_backup_mysql(self): backup.backup_mode_mysql = self.fakebackup.fake_backup_mode_mysql backup_opt = BackupOpt1() backup_opt.no_incremental = False backup_opt.mode = 'mysql' job = BackupJob(backup_opt, backup_opt.storage) assert job.execute() is None
def test_execute_backup_mysql(self, monkeypatch): self.do_monkeypatch(monkeypatch) monkeypatch.setattr(backup, 'backup_mode_mysql', self.fakebackup.fake_backup_mode_mysql) backup_opt = BackupOpt1() backup_opt.no_incremental = False backup_opt.mode = 'mysql' job = BackupJob(backup_opt) assert job.execute() is None
def test_execute_backup_mysql(self, monkeypatch): self.do_monkeypatch(monkeypatch) monkeypatch.setattr(utils, 'set_backup_level', self.fakeutils.fake_set_backup_level) monkeypatch.setattr(swift, 'get_container_content', self.fakeswift.fake_get_container_content) monkeypatch.setattr(backup, 'backup_mode_mysql', self.fakebackup.fake_backup_mode_mysql) backup_opt = BackupOpt1() backup_opt.no_incremental = False backup_opt.mode = 'mysql' job = BackupJob(backup_opt) assert job.execute() is None
def test_execute_backup_fs_incremental(self, monkeypatch): self.do_monkeypatch(monkeypatch) monkeypatch.setattr(swift, 'check_container_existance', self.fakeswift.fake_check_container_existance1) monkeypatch.setattr(swift, 'get_containers_list', self.fakeswift.fake_get_containers_list4) monkeypatch.setattr(utils, 'set_backup_level', self.fakeutils.fake_set_backup_level) monkeypatch.setattr(backup, 'backup_mode_fs', self.fakebackup.fake_backup_mode_fs) monkeypatch.setattr(swift, 'get_container_content', self.fakeswift.fake_get_container_content) backup_opt = BackupOpt1() backup_opt.mode = 'fs' backup_opt.no_incremental = False job = BackupJob(backup_opt) assert job.execute() is None
def test_execute_backup_fs_no_incremental_and_backup_level_raise( self, monkeypatch): self.do_monkeypatch(monkeypatch) backup_opt = BackupOpt1() backup_opt.mode = 'fs' backup_opt.no_incremental = True job = BackupJob(backup_opt) pytest.raises(Exception, job.execute)
def test_execute_raise(self, monkeypatch): self.do_monkeypatch(monkeypatch) monkeypatch.setattr(utils, 'set_backup_level', self.fakeutils.fake_set_backup_level) monkeypatch.setattr(swift, 'get_container_content', self.fakeswift.fake_get_container_content) backup_opt = BackupOpt1() backup_opt.no_incremental = False backup_opt.mode = None job = BackupJob(backup_opt) pytest.raises(ValueError, job.execute)