Exemple #1
0
class BackupBaseTests(TestCase):
    def setUp(self):
        """Preparations to be done before every test"""
        self.workdir = tempfile.mkdtemp(prefix='backuptool-base-tests-')
        self.backup_test_workdir = '{0}/workdir'.format(self.workdir)
        os.makedirs(self.backup_test_workdir)
        base_config = {
            'mysql_databases': ['test_db_1', 'test_db_2'],
            'mysql_user': '******',
            'mysql_password': '******',
            'ldap_backup': True,
            'rotate': 3
        }
        self.backup = Backup('test_backup',
                             config=base_config,
                             workdir=self.backup_test_workdir)

    def tearDown(self):
        shutil.rmtree(self.workdir)

    @patch('subprocess.check_call')
    def test_restore_commands(self, mock_check_call):
        os.makedirs('{0}/ldap'.format(self.backup_test_workdir))
        os.makedirs('{0}/mysql'.format(self.backup_test_workdir))
        self.backup.restore_database()
        self.backup.restore_ldap()
        self.backup.restore_files()

    @patch('subprocess.check_call')
    def test_dump_commands(self, mock_check_call):
        self.backup.dump_database()
        self.backup.dump_ldap()
Exemple #2
0
class BackupBaseTests(TestCase):
    def setUp(self):
        """Preparations to be done before every test"""
        self.workdir = tempfile.mkdtemp(prefix='backuptool-base-tests-')
        self.backup_test_workdir = '{0}/workdir'.format(self.workdir)
        os.makedirs(self.backup_test_workdir)
        base_config = {
            'mysql_databases': ['test_db_1', 'test_db_2'],
            'mysql_user': '******',
            'mysql_password': '******',
            'ldap_backup': True,
            'rotate': 3
        }
        self.backup = Backup('test_backup',
                             config=base_config,
                             workdir=self.backup_test_workdir)

    def tearDown(self):
        shutil.rmtree(self.workdir)

    @patch('subprocess.check_call')
    def test_restore_commands(self, mock_check_call):
        os.makedirs('{0}/ldap'.format(self.backup_test_workdir))
        os.makedirs('{0}/mysql'.format(self.backup_test_workdir))
        self.backup.restore_database()
        self.backup.restore_ldap()
        self.backup.restore_files()

    @patch('subprocess.check_call')
    def test_dump_commands(self, mock_check_call):
        self.backup.dump_database()
        self.backup.dump_ldap()
Exemple #3
0
 def setUp(self):
     """Preparations to be done before every test"""
     self.workdir = tempfile.mkdtemp(prefix='backuptool-base-tests-')
     self.backup_test_workdir = '{0}/workdir'.format(self.workdir)
     os.makedirs(self.backup_test_workdir)
     base_config = {
         'mysql_databases': ['test_db_1', 'test_db_2'],
         'mysql_user': '******',
         'mysql_password': '******',
         'ldap_backup': True,
         'rotate': 3
     }
     self.backup = Backup('test_backup',
                          config=base_config,
                          workdir=self.backup_test_workdir)
Exemple #4
0
 def setUp(self):
     """Preparations to be done before every test"""
     self.workdir = tempfile.mkdtemp(prefix='backuptool-base-tests-')
     self.backup_test_workdir = '{0}/workdir'.format(self.workdir)
     os.makedirs(self.backup_test_workdir)
     base_config = {
         'mysql_databases': ['test_db_1', 'test_db_2'],
         'mysql_user': '******',
         'mysql_password': '******',
         'ldap_backup': True,
         'rotate': 3
     }
     self.backup = Backup('test_backup',
                          config=base_config,
                          workdir=self.backup_test_workdir)