storage-ng / storage / backends / _tests /

# Copyright: 2011 MoinMoin:ThomasWaldmann
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.

MoinMoin - stores backend tests

Note: theoretically, it should be enough to test with one kind of store,
      but we better test with a fs AND a memory store.

from __future__ import absolute_import, division

import pytest

from ..stores import MutableBackend
from . import MutableBackendTestBase

from storage.stores.memory import BytesStore as MemoryBytesStore
from storage.stores.memory import FileStore as MemoryFileStore

class TestMemoryBackend(MutableBackendTestBase):
    def setup_method(self, method):
        meta_store = MemoryBytesStore()
        data_store = MemoryFileStore() = MutableBackend(meta_store, data_store)

import os
import tempfile

from storage.stores.fs import BytesStore as FSBytesStore
from storage.stores.fs import FileStore as FSFileStore

class TestFSBackend(MutableBackendTestBase):
    def setup_method(self, method):
        meta_path = tempfile.mkdtemp()
        meta_store = FSBytesStore(meta_path)
        data_path = tempfile.mkdtemp()
        data_store = FSFileStore(data_path) = MutableBackend(meta_store, data_store)