-- adding test/{login_test.clj,add_test.clj} to the project
[bkell-clj.git] / test / login_test.clj
blobc7f436fc4c2c0753651fd03d8726ad70a6ec5909
1 (ns login-test
3         (:use [helpers] :reload-all)
4         (:use [clojure.test])
5         (:use [depth_adapter])
6         (:require [bkell])
8         (:import java.io.ByteArrayInputStream)
9         (:require clojure.contrib.str-utils)
10     (:require commands.add)
14 (def configs (load-file "etc/config/config.test.clj"))
17 ;; FIXTUREs
18 (defn test-fixture-shell
19     "Initialize the shell"
20     [test]
22     (bkell/init-shell)
24 (defn test-fixture-db
25     "test to clear out shell memory before a test is run"
26     [test]
28     ;; make the shell active
29         (dosync
30                 (alter bkell/shell conj
31                         { :active true }))
33     ;; create a basic user in the DB
34     (add-user (:url-test configs) (:system-dir configs) { :tag "user" :attrs { :id "test.user" } } )
36     ;; ** execute the TEST function
37     (test)
39     ;; make the shell inactive
40         (dosync
41                 (alter bkell/shell conj
42                         { :active false }))
46 (use-fixtures :once test-fixture-shell)
47 (use-fixtures :each test-fixture-db)
49 ;; test basic login
50 (deftest test-login []
52     (is (= 5 5))
56 ;; test result when already logged in
57 (deftest test-existing-login []
62 ;; test a login with a bad password
63 (deftest test-bad-password []
68 ;; test logging out
69 (deftest test-logout []