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_sizes(): msg = "tis is äi dest mässätsch" K = KVFS(dict()) K.create("/blub") attr = K.getattr("/blub") assert attr['st_size'] == 0, attr['st_size'] K.write("/blub", msg) attr = K.getattr("/blub") assert attr['st_size'] == len(msg), (attr['st_size'], len(msg))
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_dir_write(): K = KVFS(dict()) K.mkdir("/blub") K.write("/blub", "bla bla")
def test_noexists_write(): K = KVFS(dict()) K.write("/blub", "bla bla")