Add another arity to list-blobs so that it can be called without the blobstore argument. Also add some basic tests for list-blobs-test.

This commit is contained in:
David Santiago 2011-04-04 15:54:35 -05:00
parent 53c735fdff
commit 57f0dcaf15
2 changed files with 11 additions and 4 deletions

View File

@ -169,10 +169,12 @@ Note: (apply concat coll) or (lazy-cat coll) are not lazy wrt coll itself."
(defn list-blobs (defn list-blobs
"Returns a lazy seq of all blobs in the given container." "Returns a lazy seq of all blobs in the given container."
([container prefix #^BlobStore blobstore] ([container]
(concat-elements (list-blobs-chunks container prefix blobstore :start))) (list-blobs container *blobstore*))
([container #^BlobStore blobstore] ([container blobstore]
(list-blobs container nil blobstore))) (list-blobs container nil blobstore))
([container prefix blobstore]
(concat-elements (list-blobs-chunks container prefix blobstore :start))))
(defn locations (defn locations
"Retrieve the available container locations for the blobstore context." "Retrieve the available container locations for the blobstore context."

View File

@ -77,6 +77,11 @@
(is (= 3 (count (list-container "container" :with-details true)))) (is (= 3 (count (list-container "container" :with-details true))))
(is (= 1 (count (list-container "container" :in-directory "dir"))))) (is (= 1 (count (list-container "container" :in-directory "dir")))))
(deftest list-blobs-test
(is (create-container "container"))
(is (empty? (list-blobs "container")))
(is (empty? (list-blobs "container" "/a" *blobstore*))))
(deftest get-blob-test (deftest get-blob-test
(is (create-container "blob")) (is (create-container "blob"))
(is (upload-blob "blob" "blob1" "blob1")) (is (upload-blob "blob" "blob1" "blob1"))