         [com.puppetlabs.cmdb.scf.migrate :only [migrate!]]
         [clojure.test]
         [clojure.math.combinatorics :only (combinations)]
+        [clj-time.core :only [now]]
+        [clj-time.coerce :only [to-timestamp]]
         [com.puppetlabs.jdbc :only [query-to-vec]]
         [com.puppetlabs.cmdb.testutils :only [test-db]]))
 

          (migrate!)
          (add-certname! certname)
          (let [hash1 (add-catalog! catalog)]
            (associate-catalog-with-certname! hash1 certname (java.util.Date.))
            (dissociate-catalog-with-certname! hash1 certname))
          (garbage-collect!)



      (testing "auto-reactivated based on a command"
        (let [one-day             (* 24 60 60 1000)
              before-deactivating (to-timestamp (- (System/currentTimeMillis) one-day))
              after-deactivating  (to-timestamp (+ (System/currentTimeMillis) one-day))]
          (testing "should activate the node if the command happened after it was deactivated"
            (deactivate-node! certname)
            (is (= true (maybe-activate-node! certname after-deactivating)))
