From d114073413ffd2b429a4830ca170b3abd57cbe43 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Sat, 10 May 2014 16:48:32 -0400 Subject: [PATCH] monger.command tests now pass --- test/monger/test/command_test.clj | 48 +++++++++++++++---------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/test/monger/test/command_test.clj b/test/monger/test/command_test.clj index d3144db..cc257ae 100644 --- a/test/monger/test/command_test.clj +++ b/test/monger/test/command_test.clj @@ -1,36 +1,34 @@ (ns monger.test.command-test (:require [monger.core :as mg] [monger.command :as mcom] - [monger.test.helper :as helper] [monger.collection :as mc] [clojure.test :refer :all] [monger.result :refer [ok?]] [monger.conversion :refer [from-db-object]])) -(helper/connect!) +(let [conn (mg/connect) + db (mg/get-db conn "monger-test")] + (deftest ^{:command true} test-reindex-collection + (let [_ (mc/insert db "test" {:name "Clojure"}) + result (mcom/reindex-collection db "test")] + (is (ok? result)) + (is (get result "indexes")))) + (deftest ^{:command true} test-server-status + (let [status (mcom/server-status db)] + (is (ok? status)) + (is (not-empty status)) + (is (get status "serverUsed")))) -(deftest ^{:command true} test-reindex-collection - (let [_ (mc/insert "test" {:name "Clojure"}) - result (mcom/reindex-collection "test")] - (is (ok? result)) - (is (get result "indexes")))) + (deftest ^{:command true} test-top + (let [result (mcom/top conn)] + (is (ok? result)) + (is (not-empty result)) + (is (get result "serverUsed")))) -(deftest ^{:command true} test-server-status - (let [status (mcom/server-status)] - (is (ok? status)) - (is (not-empty status)) - (is (get status "serverUsed")))) - -(deftest ^{:command true} test-top - (let [result (mcom/top)] - (is (ok? result)) - (is (not-empty result)) - (is (get result "serverUsed")))) - -(deftest ^{:command true} test-running-is-master-as-an-arbitrary-command - (let [raw (mg/command {:isMaster 1}) - result (from-db-object raw true)] - (is (ok? result)) - (is (ok? raw)) - (is (:ismaster result)))) + (deftest ^{:command true} test-running-is-master-as-an-arbitrary-command + (let [raw (mg/command db {:isMaster 1}) + result (from-db-object raw true)] + (is (ok? result)) + (is (ok? raw)) + (is (:ismaster result)))))