Fix search and uberjar tests.
This commit is contained in:
parent
f8831ed80f
commit
668919b15d
3 changed files with 7 additions and 9 deletions
|
@ -19,11 +19,11 @@
|
|||
(defn index-location [url]
|
||||
(io/file (home-dir) "indices" (string/replace url #"[:/]" "_")))
|
||||
|
||||
(defn remote-index-location [url]
|
||||
(format "%s/.index/nexus-maven-repository-index.zip" url))
|
||||
(defn remote-index-url [url]
|
||||
(URL. (format "%s/.index/nexus-maven-repository-index.zip" url)))
|
||||
|
||||
(defn- download-index [[id {url :url}]]
|
||||
(with-open [stream (.openStream (URL. (remote-index-location url)))]
|
||||
(with-open [stream (.openStream (remote-index-url url))]
|
||||
(println "Downloading index from" id "-" url)
|
||||
(let [tmp (java.io.File/createTempFile "lein" "index")]
|
||||
(try (io/copy stream tmp)
|
||||
|
|
|
@ -3,13 +3,11 @@
|
|||
(:use [clojure.test]
|
||||
[leiningen.search]))
|
||||
|
||||
(deftest test-download
|
||||
(is (= ["segments.gen" "_0.cfx" "timestamp" "_0.cfs" "segments_2"]
|
||||
(vec (.list (index-location "http://example.com/repo"))))))
|
||||
|
||||
(deftest test-searchy
|
||||
(binding [remote-index-location (constantly "file://test/sample-index.zip")]
|
||||
(binding [remote-index-url (constantly (io/resource "test/sample-index.zip"))]
|
||||
(ensure-fresh-index ["test" {:url "http://example.com/repo"}])
|
||||
(is (= ["segments.gen" "_0.cfx" "timestamp" "_0.cfs" "segments_2"]
|
||||
(vec (.list (index-location "http://example.com/repo")))))
|
||||
(let [results (search-repository ["test" {:url "http://example.com/repo"}]
|
||||
"hooke")]
|
||||
(is (= '#{[[robert/hooke "1.0.0"] "Hooke your functions!"]
|
||||
|
|
|
@ -17,5 +17,5 @@
|
|||
(map (memfn getName))
|
||||
set)]
|
||||
(is (entries "nom/nom/nom.clj"))
|
||||
(is (entries "robert/hooke.clj"))
|
||||
(is (entries "org/codehaus/janino/Compiler$1.class"))
|
||||
(is (not (some #(re-find #"dummy" %) entries)))))
|
||||
|
|
Loading…
Reference in a new issue