mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-03 06:03:06 +00:00
cleanup
This commit is contained in:
parent
1e6fc450f5
commit
485f2ecaed
@ -68,82 +68,6 @@ suite "Test Basic ThreadProxyDatastore":
|
||||
|
||||
basicStoreTests(ds, key, bytes, otherBytes)
|
||||
|
||||
# suite "Test Misc FSDatastore":
|
||||
# let
|
||||
# path = currentSourcePath() # get this file's name
|
||||
# basePath = "tests_data"
|
||||
# basePathAbs = path.parentDir / basePath
|
||||
# bytes = "some bytes".toBytes
|
||||
|
||||
# setup:
|
||||
# removeDir(basePathAbs)
|
||||
# require(not dirExists(basePathAbs))
|
||||
# createDir(basePathAbs)
|
||||
|
||||
# teardown:
|
||||
# removeDir(basePathAbs)
|
||||
# require(not dirExists(basePathAbs))
|
||||
|
||||
# test "Test validDepth()":
|
||||
# let
|
||||
# fs = FSDatastore.new(root = "/", depth = 3).tryGet()
|
||||
# invalid = Key.init("/a/b/c/d").tryGet()
|
||||
# valid = Key.init("/a/b/c").tryGet()
|
||||
|
||||
# check:
|
||||
# not fs.validDepth(invalid)
|
||||
# fs.validDepth(valid)
|
||||
|
||||
# test "Test invalid key (path) depth":
|
||||
# let
|
||||
# fs = FSDatastore.new(root = basePathAbs, depth = 3).tryGet()
|
||||
# key = Key.init("/a/b/c/d").tryGet()
|
||||
|
||||
# check:
|
||||
# (await fs.put(key, bytes)).isErr
|
||||
# (await fs.get(key)).isErr
|
||||
# (await fs.delete(key)).isErr
|
||||
# (await fs.has(key)).isErr
|
||||
|
||||
# test "Test valid key (path) depth":
|
||||
# let
|
||||
# fs = FSDatastore.new(root = basePathAbs, depth = 3).tryGet()
|
||||
# key = Key.init("/a/b/c").tryGet()
|
||||
|
||||
# check:
|
||||
# (await fs.put(key, bytes)).isOk
|
||||
# (await fs.get(key)).isOk
|
||||
# (await fs.delete(key)).isOk
|
||||
# (await fs.has(key)).isOk
|
||||
|
||||
# test "Test key cannot write outside of root":
|
||||
# let
|
||||
# fs = FSDatastore.new(root = basePathAbs, depth = 3).tryGet()
|
||||
# key = Key.init("/a/../../c").tryGet()
|
||||
|
||||
# check:
|
||||
# (await fs.put(key, bytes)).isErr
|
||||
# (await fs.get(key)).isErr
|
||||
# (await fs.delete(key)).isErr
|
||||
# (await fs.has(key)).isErr
|
||||
|
||||
# test "Test key cannot convert to invalid path":
|
||||
# let
|
||||
# fs = FSDatastore.new(root = basePathAbs).tryGet()
|
||||
|
||||
# for c in invalidFilenameChars:
|
||||
# if c == ':': continue
|
||||
# if c == '/': continue
|
||||
|
||||
# let
|
||||
# key = Key.init("/" & c).tryGet()
|
||||
|
||||
# check:
|
||||
# (await fs.put(key, bytes)).isErr
|
||||
# (await fs.get(key)).isErr
|
||||
# (await fs.delete(key)).isErr
|
||||
# (await fs.has(key)).isErr
|
||||
|
||||
# suite "Test Query":
|
||||
# let
|
||||
# path = currentSourcePath() # get this file's name
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user