(ns riemann.hipchat-test
  (:use riemann.hipchat
        clojure.test)
  (:require [riemann.logging :as logging]))

(def api-key (System/getenv "HIPCHAT_API_KEY"))
(def room (System/getenv "HIPCHAT_ALERT_ROOM"))
(def alert_user "Riemann_HC_Test")

(when-not api-key
  (println "export HIPCHAT_API_KEY=\"...\" to run these tests."))

(when-not room
  (println "export HIPCHAT_ALERT_ROOM=\"...\" to run these tests."))

(logging/init)

(deftest good_event
  (let [hc (hipchat {:token api-key :room room :from alert_user :notify 0})]
    (hc {:host "localhost"
         :service "hipchat test good"
         :metric 42
         :state "ok"})))

(deftest error_event
  (let [hc (hipchat {:token api-key :room room :from alert_user :notify 0})]
    (hc {:host "localhost"
         :service "hipchat test error"
         :metric 43
         :state "error"})))

(deftest critical_event
  (let [hc (hipchat {:token api-key :room room :from alert_user :notify 0})]
    (hc {:host "localhost"
         :service "hipchat test critical"
         :metric 44
         :state "critical"})))

(deftest yellow
  (let [hc (hipchat {:token api-key :room room :from alert_user :notify 0})]
    (hc {:host "localhost"
         :service "hipchat test yellow"
         :metric 45
         :state "unknown"})))

(deftest multiple_events
  (let [hc (hipchat {:token api-key :room room :from alert_user :notify 0})]
    (hc [{:host "localhost"
          :service "hipchat multi 1"
          :metric 46
          :state "ok"}
         {:host "localhost"
          :service "hipchat multi 2"
          :metric 47
          :state "ok"}])))

Add some basic hipchat tests
Add some basic hipchat tests

topecz/riemann,yeller/riemann,moonranger/riemann,nelhage/riemann,VideoAmp/riemann-1,mfournier/riemann,jamtur01/riemann,pradeepchhetri/riemann,yeller/riemann,fullcontact/riemann,rekhajoshm/riemann,timbuchwaldt/riemann,topecz/riemann,patrox/riemann,pyr/riemann,forter/riemann,cswaroop/riemann,aphyr/riemann,ClodoCorp/riemann,rhysr/riemann,vincentbernat/riemann,cswaroop/riemann,abailly/riemann,bowlofstew/riemann,forter/riemann,forter/riemann,abailly/riemann,eric/riemann,tzach/riemann,jamtur01/riemann,ClodoCorp/riemann,yeller/riemann,aphyr/riemann,micrub/riemann,eric/riemann,nelhage/riemann,moonranger/riemann,rhysr/riemann,mirwan/riemann,patrox/riemann,twosigma/riemann,bfritz/riemann,bmhatfield/riemann,mfournier/riemann,alq666/riemann,rekhajoshm/riemann,robashton/riemann,counsyl/riemann,mirwan/riemann,joerayme/riemann,bmhatfield/riemann,nelhage/riemann,ClodoCorp/riemann,tzach/riemann,irudyak/riemann,patrox/riemann,twosigma/riemann,mbuczko/riemann,fullcontact/riemann,nberger/riemann,DasAllFolks/riemann,vixns/riemann,tzach/riemann,jeanpralo/riemann,pyr/riemann,lispmeister/riemann,timbuchwaldt/riemann,pharaujo/riemann,lispmeister/riemann,riemann/riemann,nberger/riemann,vincentbernat/riemann,bwilber/riemann,AkihiroSuda/riemann,udoprog/riemann,VideoAmp/riemann-1,bfritz/riemann,AkihiroSuda/riemann,bowlofstew/riemann,topecz/riemann,algernon/riemann,LubyRuffy/riemann,algernon/riemann,udoprog/riemann,fullcontact/riemann,stanislas/riemann,zamaterian/riemann,lispmeister/riemann,riemann/riemann,mirwan/riemann,joerayme/riemann,mfournier/riemann,stanislas/riemann,rhysr/riemann,Anvil/riemann,robashton/riemann,pharaujo/riemann,vixns/riemann,alq666/riemann,zamaterian/riemann,mbuczko/riemann,bg451/riemann,udoprog/riemann,DasAllFolks/riemann,micrub/riemann,twosigma/riemann,shokunin/riemann,irudyak/riemann,stanislas/riemann,rekhajoshm/riemann,Anvil/riemann,bg451/riemann,shokunin/riemann,jeanpralo/riemann,algernon/riemann,counsyl/riemann,LubyRuffy/riemann,bwilber/riemann,cswaroop/riemann,pradeepchhetri/riemann,micrub/riemann,shokunin/riemann