Add more assertions to the URI connection test
This commit is contained in:
parent
805a66e9c1
commit
e481b1ca84
1 changed files with 8 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
(ns monger.test.core-test
|
(ns monger.test.core-test
|
||||||
(:require [monger core collection util result]
|
(:require [monger core collection util result]
|
||||||
[monger.test.helper :as helper]
|
[monger.test.helper :as helper]
|
||||||
[monger.collection :as mgcol])
|
[monger.collection :as mc])
|
||||||
(:import [com.mongodb Mongo DB WriteConcern MongoOptions ServerAddress])
|
(:import [com.mongodb Mongo DB WriteConcern MongoOptions ServerAddress])
|
||||||
(:use clojure.test
|
(:use clojure.test
|
||||||
[monger.core :only [server-address mongo-options]]))
|
[monger.core :only [server-address mongo-options]]))
|
||||||
|
|
@ -32,7 +32,13 @@
|
||||||
|
|
||||||
(deftest connect-to-mongo-via-uri-with-valid-credentials
|
(deftest connect-to-mongo-via-uri-with-valid-credentials
|
||||||
(let [connection (monger.core/connect-via-uri! "mongodb://clojurewerkz/monger!:monger!@127.0.0.1/monger-test4")]
|
(let [connection (monger.core/connect-via-uri! "mongodb://clojurewerkz/monger!:monger!@127.0.0.1/monger-test4")]
|
||||||
(is (= (-> connection .getAddress ^InetAddress (.sameHost "127.0.0.1")))))
|
(is (= "monger-test4" (.getName (monger.core/current-db))))
|
||||||
|
(is (= (-> connection .getAddress ^InetAddress (.sameHost "127.0.0.1"))))
|
||||||
|
(mc/remove "documents")
|
||||||
|
;; make sure that the database is selected
|
||||||
|
;; and operations get through.
|
||||||
|
(mc/insert "documents" {:field "value"})
|
||||||
|
(is (= 1 (mc/count "documents" {}))))
|
||||||
;; reconnect using regular host
|
;; reconnect using regular host
|
||||||
(helper/connect!)))
|
(helper/connect!)))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue