Make sure that tests that perform authentication and drop databases do not affect authentication tests
Fixes the build.
This commit is contained in:
parent
e29655a7fd
commit
13135c10dd
2 changed files with 16 additions and 11 deletions
|
|
@ -1,5 +1,5 @@
|
|||
(ns monger.test.authentication
|
||||
(:require [monger core util]
|
||||
(:require [monger core util db]
|
||||
[monger.test.helper :as helper])
|
||||
(:use [clojure.test]))
|
||||
|
||||
|
|
|
|||
|
|
@ -11,19 +11,24 @@
|
|||
|
||||
(deftest test-add-user
|
||||
(let [username "clojurewerkz/monger!"
|
||||
pwd (.toCharArray "monger!")]
|
||||
(monger.db/add-user username pwd)
|
||||
(is (monger.core/authenticate "monger-test" username pwd))))
|
||||
pwd (.toCharArray "monger!")
|
||||
db-name "monger-test4"]
|
||||
;; use a secondary database here. MK.
|
||||
(monger.core/with-db (monger.core/get-db db-name)
|
||||
(monger.db/add-user username pwd)
|
||||
(is (monger.core/authenticate db-name username pwd)))))
|
||||
|
||||
|
||||
(deftest test-drop-database
|
||||
(let [collection "test"
|
||||
_ (mgcol/insert collection { :name "Clojure" })
|
||||
check (mgcol/count collection)
|
||||
_ (monger.db/drop-db)]
|
||||
(is (= 1 check))
|
||||
(is (not (mgcol/exists? collection)))
|
||||
(is (= 0 (mgcol/count collection)))))
|
||||
;; drop a secondary database here. MK.
|
||||
(monger.core/with-db (monger.core/get-db "monger-test3")
|
||||
(let [collection "test"
|
||||
_ (mgcol/insert collection { :name "Clojure" })
|
||||
check (mgcol/count collection)
|
||||
_ (monger.db/drop-db)]
|
||||
(is (= 1 check))
|
||||
(is (not (mgcol/exists? collection)))
|
||||
(is (= 0 (mgcol/count collection))))))
|
||||
|
||||
|
||||
(deftest test-get-collection-names
|
||||
|
|
|
|||
Loading…
Reference in a new issue