tests implementation finished

This commit is contained in:
Christian Mueller
2012-06-05 21:48:52 +02:00
parent e3d4eff459
commit a05ac74185
4 changed files with 45 additions and 60 deletions
-31
View File
@@ -1,31 +0,0 @@
(ns NoteHub.test.all
(:use [NoteHub.storage] [clojure.test]))
(def date [2012 06 03])
(def test-title "Some title.")
(def test-note "This is a test note.")
(testing "Storage"
(testing "of correct note creation"
(is (= (do
(set-note date test-title test-note)
(get-note date test-title))
test-note)))
(testing "of the note access"
(is (not= (get-note date test-title) "any text")))
(testing "of note existence"
(is (note-exists? date test-title))
(is (not (do
(delete-note date test-title)
(note-exists? date test-title))))
(is (not (note-exists? [2013 06 03] test-title)))
(is (not (note-exists? date "some title")))))
; to test
;
; crossover.lib
; storage
; pages
; noir.util.test
+1 -1
View File
@@ -1,4 +1,4 @@
(ns NoteHub.test.all
(ns NoteHub.test.storage
(:use [NoteHub.storage] [clojure.test]))
(def date [2012 06 03])
+19
View File
@@ -0,0 +1,19 @@
(ns NoteHub.test.views.pages
(:use [NoteHub.views.pages]
[noir.util.test]
[clojure.test]))
(deftest helper-functions
(testing "Markdown generation"
(is (= "<h1><em>hello</em> <strong>world</strong></h1><p>test <code>code</code></p>"
(md-to-html "#_hello_ __world__\ntest `code`")))))
(deftest requests
(testing "HTTP Statuses"
(testing "of a wrong access"
(has-status (send-request "/wrong-page") 404))
(testing "of corrupt note-post"
(has-status (send-request [:post "/2012/06/04/wrong-title"]) 404)
(has-status (send-request [:post "/post-note"]) 400))
(testing "valid accesses"
(has-status (send-request "/") 200))))