Ejemplo n.º 1
0
 def test_configure_attach_recoverable_encryption_no_backup_folder_no_backup_settings(
         self):
     self._init_filer()
     self._filer.get = mock.MagicMock(
         side_effect=TestEdgeBackup._mock_get_no_backup_settings)
     self._filer.execute = mock.MagicMock(
         side_effect=TestEdgeBackup._mock_execute)
     taskmgr.wait = mock.MagicMock(
         side_effect=TestEdgeBackup.
         _mock_recoverable_encryption_attach_folder_not_found_create_folder_ok
     )
     backup.Backup(self._filer).configure()
     taskmgr.wait.assert_has_calls([
         mock.call(self._filer, TestEdgeBackup._task_attach_folder),
         mock.call(self._filer, TestEdgeBackup._task_create_folder)
     ])
     self._filer.execute.assert_has_calls([
         mock.call('/status/services', 'attachFolder'),
         mock.call('/status/services', 'createFolder', mock.ANY)
     ])
     expected_param = self._get_create_folder_param()
     actual_param = self._filer.execute.call_args_list[1][0][2]
     self._assert_equal_objects(actual_param, expected_param)
     self._filer.get.assert_has_calls([
         mock.call('/config/backup'),
         mock.call('/defaults/BackupSettings')
     ])
     self._filer.put.assert_called_once_with('/config/backup', mock.ANY)
     expected_param = self._get_default_backup_settings(
         backup.EncryptionMode.Recoverable, TestEdgeBackup._shared_secret,
         TestEdgeBackup._passphrase_salt)
     actual_param = self._filer.put.call_args[0][1]
     self._assert_equal_objects(actual_param, expected_param)
Ejemplo n.º 2
0
 def test_attach_clocks_out_of_sync(self):
     self._init_filer()
     self._filer.execute = mock.MagicMock(
         side_effect=TestEdgeBackup._mock_execute)
     taskmgr.wait = mock.MagicMock(
         return_value=TestEdgeBackup._get_attach_response(
             backup.AttachRC.ClocksOutOfSync))
     with self.assertRaises(backup.ClocksOutOfSync) as error:
         backup.Backup(self._filer).configure()
     self.assertEqual('Clocks are out of sync', error.exception.message)
Ejemplo n.º 3
0
 def test_attach_incorrect_passphrase(self):
     self._init_filer()
     self._filer.execute = mock.MagicMock(
         side_effect=TestEdgeBackup._mock_execute)
     taskmgr.wait = mock.MagicMock(
         return_value=TestEdgeBackup._get_attach_response(
             backup.AttachRC.CheckCodeInCorrect))
     with self.assertRaises(backup.IncorrectPassphrase) as error:
         backup.Backup(self._filer).configure()
     self.assertEqual('Incorrect passphrase', error.exception.message)
Ejemplo n.º 4
0
 def test_attach_permission_denied(self):
     self._init_filer()
     self._filer.execute = mock.MagicMock(
         side_effect=TestEdgeBackup._mock_execute)
     taskmgr.wait = mock.MagicMock(
         return_value=TestEdgeBackup._get_attach_response(
             backup.AttachRC.PermissionDenied))
     with self.assertRaises(exception.CTERAException) as error:
         backup.Backup(self._filer).configure()
     self.assertEqual('Failed to attach to backup folder',
                      error.exception.message)
Ejemplo n.º 5
0
 def test_unsuspend_backup(self):
     self._init_filer()
     backup.Backup(self._filer).unsuspend()
     self._filer.execute.assert_called_once_with('/status/sync', 'resume')
Ejemplo n.º 6
0
 def test_start_backup(self):
     self._init_filer()
     backup.Backup(self._filer).start()
     self._filer.execute.assert_called_once_with('/status/sync', 'start')
Ejemplo n.º 7
0
 def test_is_configured(self):
     self._init_filer(
         get_response=TestEdgeBackup._get_backup_status_response())
     backup.Backup(self._filer).is_configured()
     self._filer.get.assert_called_once_with('/proc/backup/backupStatus')