Permalink
Browse files

fixed tests for fluiddb checking for empty ns on delete. commented te…

…sts on returned URI's, as there is a bug in fluiddb
  • Loading branch information...
1 parent 7302fdb commit a23d94b19e3a656a7aa9acc3a2ba91a07690a2df @hugoduncan committed Dec 4, 2009
Showing with 13 additions and 15 deletions.
  1. +4 −8 src/clj_fluiddb.clj
  2. +9 −7 test/clj_fluiddb/test/integration.clj
View
@@ -25,7 +25,6 @@
(str arg)))
(defn encode-options [options]
- ;; (println "encode options" options)
(if options
(apply str "?"
(interpose "&"
@@ -48,12 +47,14 @@
use-https (fdb :use-https)
url (str (if (or (nil? use-https) use-https) "https://" "http://") host "/" (encode-path path) (encode-options path-options))
connection (connection/http-connection url)]
- ;; (println (name method) url)
+
(doto connection
(.setRequestMethod (name method))
- (.setRequestProperty "Accept" (or (and options (options :accept)) (fdb :accept) *content-type*))
(.setRequestProperty "User-agent" (or (fdb :user-agent) *user-agent*)))
+ (if (= (name method) "GET")
+ (.setRequestProperty connection "Accept" (or (and options (options :accept)) (fdb :accept) *content-type*)))
+
(if body-data
(.setRequestProperty connection "Content-type" (or (and options (options :content-type)) *content-type*)))
@@ -66,11 +67,6 @@
(if-let [user (fdb :user)]
(.setRequestProperty connection "Authorization" (credentials user (fdb :password))))
-;; (println "c-t" (.getRequestProperty connection "Content-type"))
-;; (println "c-t-e" (.getRequestProperty connection "Content-transfer-encoding"))
-;; (println "a" (.getRequestProperty connection "Accept"))
-;; (println body-data)
-
(connection/start-http-connection connection body-data)
(let [response-code (.getResponseCode connection)
@@ -22,7 +22,7 @@
(is (= 201 response-code))
(is (values "id"))
(is (values "URI"))
- (is (= (str "http://" (*test-fdb* :host) "/objects/" (values "id")) (values "URI")))
+ ;; (is (= (str "http://" (*test-fdb* :host) "/objects/" (values "id")) (values "URI")))
(let [ [values2 response-code content-type headers] (get-object (values "id") :about)]
(is (= 200 response-code))
(is (= (values2 "tagPaths") []))))))
@@ -34,7 +34,7 @@
(is (= 201 response-code))
(is (values "id"))
(is (values "URI"))
- (is (= (str "http://" (*test-fdb* :host) "/objects/" (values "id")) (values "URI")))
+ ;; (is (= (str "http://" (*test-fdb* :host) "/objects/" (values "id")) (values "URI")))
(let [ [values2 response-code content-type headers] (get-object (values "id") :about)]
(is (= 200 response-code))
(is (= (values2 "tagPaths") ["fluiddb/about"]))
@@ -47,8 +47,8 @@
(let [[values response rest] (create-namespace (*test-fdb* :user) ns description)]
(is (= 201 response))
(is (values "id"))
- (is (values "URI"))
- (is (= (str "http://" (*test-fdb* :host) "/namespaces/test/" ns) (values "URI"))))
+ (is (values "URI")))
+ ;; (is (= (str "http://" (*test-fdb* :host) "/namespaces/test/" ns) (values "URI"))))
(let [ [values response rest] (get-namespace (str (*test-fdb* :user) "/" ns) :return-description)]
(is (= 200 response))
(is (values "id"))
@@ -77,7 +77,9 @@
(is (= 201 response))
(is (values "id"))
(is (values "URI"))
- (is (= (str "http://" (*test-fdb* :host) "/tags/" ns "/" name) (values "URI")))
+ ;; (is (= (str "http://" (*test-fdb* :host) "/tags/" ns "/" name) (values "URI")))
+ (let [[values2 response2 rest] (delete-tag ns name)]
+ (is (= 204 response2))) ; fluiddb is now checking for empty ns
(delete-namespace ns))))
@@ -90,7 +92,7 @@
(is (= 201 response))
(is (values "id"))
(is (values "URI"))
- (is (= (str "http://" (*test-fdb* :host) "/tags/" ns "/" name) (values "URI")))
+ ;; (is (= (str "http://" (*test-fdb* :host) "/tags/" ns "/" name) (values "URI")))
(let [[values2 response2 rest] (delete-tag ns name)]
(is (= 204 response2)))
(delete-namespace ns))))
@@ -136,4 +138,4 @@
(is (= 204 response)))
(is (thrown? java.io.FileNotFoundException (get-object-tag-value id (str ns "/" tag))))
(is (= 204 (second (delete-tag ns tag))))
- (is (= 204 (second (delete-namespace ns)))))))
+ (is (= 204 (second (delete-namespace ns)))))))

0 comments on commit a23d94b

Please sign in to comment.