 (ns notehub.test.handler
   (:use clojure.test
+        [notehub.api :only [build-key get-date url]]
+        notehub.storage
         ring.mock.request
+        notehub.test.api
         notehub.handler))
 
-(defn substring? [a b] (not (= nil (re-matches (re-pattern (str "(?s).*" a ".*")) b))))
 (def date [2012 6 3])
 (def test-title "some-title")
 (def test-note "# This is a test note.\nHello _world_. Motörhead, тест.")
-
-
-#_(
-
-   (ns NoteHub.test.views.pages
-  (:use [NoteHub.views.pages]
-        [NoteHub.api :only [build-key get-signature get-date url]]
-        [noir.util.test]
-        [NoteHub.storage]
-        [clojure.test]))
-
 
 (defn create-testnote-fixture [f]
   (add-note (build-key date test-title) test-note "testPID")

      (is (has-status (send-request "/") 200) "accessing landing page"))))


   )


(deftest test-app
  (testing "main route"
    (let [response (app (request :get "/"))]

                  [:post "/post-note"]
                  {:session session-key
                   :note test-note
                   :signature (sign session-key test-note)})]
        (is (has-status resp 302))
        (is (note-exists? (build-key date title)))
        (is (substring? "Hello _world_"
