def test_readonly(self):
        store0 = DictStore()
        store0.put(u"file1", b"content")

        store = ReadOnlyDecorator(store0)
        with pytest.raises(AttributeError):
            store.put(u"file1", b"content2")
        with pytest.raises(AttributeError):
            store.delete(u"file1")
        assert store.get(u"file1") == b"content"
        assert u"file1" in store
        assert set(store.keys()) == {u"file1"}
示例#2
0
    def store(self, request, prefix):
        base_store = DictStore()

        # do we add extra keys to the underlying store?
        if request.param:
            base_store.put(u"some_other_value", b"data1")
            base_store.put(u"ends_with_short_", b"data2")
            base_store.put(u"xx", b"data3")
            base_store.put(u"test", b"data4")

        return PrefixDecorator(prefix, base_store)
示例#3
0
 def base_store(self):
     return DictStore()
示例#4
0
def _create_store_mem(type, params):
    # TODO: Docstring with required params.
    from minimalkv.memory import DictStore

    return DictStore()
 def store(self):
     return DictStore()
 def backing_store(self):
     return DictStore()
 def front_store(self):
     return DictStore()