예제 #1
0
파일: test_nova.py 프로젝트: szaher/freezer
    def setUp(self):
        super(TestNovaEngineS3Storage, self).setUp()
        self.mock_s3_storage = mock.MagicMock()
        self.mock_s3_storage.get_object()['Body'].read.return_value \
            = self.instance_ids_str
        self.mock_s3_storage.put_object = mock.MagicMock()
        self.mock_s3_storage.storage_path = 'test/storage/path'

        self.mock_s3_storage._type = 's3'

        self.engine = nova.NovaEngine(self.mock_s3_storage)
        self.engine.client = self.backup_opt.client_manager
        self.engine.backup = mock.Mock()
        self.engine.restore = mock.Mock()
        self.engine.nova = self.mock_nova
예제 #2
0
파일: test_nova.py 프로젝트: szaher/freezer
    def setUp(self):
        super(TestNovaEngineSwiftStorage, self).setUp()
        self.mock_swift_connection = mock.MagicMock()
        self.mock_swift_connection.get_object.return_value = (
            None, self.instance_ids_str)
        self.mock_swift_connection.put_object = mock.MagicMock()

        self.mock_swift_storage = mock.MagicMock()
        self.mock_swift_storage._type = 'swift'

        self.engine = nova.NovaEngine(self.mock_swift_storage)
        self.engine.client = self.backup_opt.client_manager
        self.engine.client.create_swift = mock.Mock(
            return_value=self.mock_swift_connection)
        self.engine.backup = mock.Mock()
        self.engine.restore = mock.Mock()
        self.engine.nova = self.mock_nova
예제 #3
0
    def setUp(self):
        super(TestNovaEngineFSLikeStorage, self).setUp()
        self.mock_file = mock.Mock()
        self.mock_file.readline = mock.Mock(return_value=self.instance_ids_str)
        self.mock_file.write = mock.Mock()

        self.mock_fslike_storage = mock.MagicMock()
        self.mock_fslike_storage.open = mock.Mock(
            return_value=FakeContextManager(self.mock_file))
        self.mock_fslike_storage.storage_path = 'test/storage/path'
        self.local_backup_file = os.path.join(
            self.mock_fslike_storage.storage_path, "project_test-project-id")

        self.engine = nova.NovaEngine(self.mock_fslike_storage)
        self.engine.client = self.backup_opt.client_manager
        self.engine.backup = mock.Mock()
        self.engine.restore = mock.Mock()
        self.engine.nova = self.mock_nova