def test_truncate(): K = KVFS(dict()) K.create("/blub") K.write("/blub", "hello world") K.truncate("/blub", 5) data = K.read("/blub", 10) assert data == "hello"
def test_basic_readwrite(): msg = "Hello Wörld!" K = KVFS(dict()) K.create("/blub") K.write("/blub", msg, 0) msg2 = K.read("/blub", len(msg), 0) assert msg == msg2, (msg, msg2)
def test_hardlink(): msg = "Hello Wörld!" K = KVFS(dict()) K.create("/blub") K.write("/blub", msg) K.link("/bla", "/blub") # This doesn't work if 'write' and 'link' order is changed, # but that problem is a deeper one. msg2 = K.read("/bla", len(msg)) assert msg == msg2, (msg, msg2)
def test_noexists_read(): K = KVFS(dict()) K.read("/blub")
def test_dirs_read(): K = KVFS(dict()) K.mkdir("/blub") K.read("/blub")