aboutsummaryrefslogtreecommitdiff
path: root/server/test/Thermoprint
diff options
context:
space:
mode:
authorGregor Kleen <pngwjpgh@users.noreply.github.com>2016-07-18 12:22:23 +0200
committerGregor Kleen <pngwjpgh@users.noreply.github.com>2016-07-18 12:22:23 +0200
commit9e17810329dbfa0adc0ee3042556fbd13f810d5c (patch)
treee213225286891369211b51c793bc55633298229e /server/test/Thermoprint
parent6831491b904403beb7fd3899b28e0deaa86d767d (diff)
downloadthermoprint-9e17810329dbfa0adc0ee3042556fbd13f810d5c.tar
thermoprint-9e17810329dbfa0adc0ee3042556fbd13f810d5c.tar.gz
thermoprint-9e17810329dbfa0adc0ee3042556fbd13f810d5c.tar.bz2
thermoprint-9e17810329dbfa0adc0ee3042556fbd13f810d5c.tar.xz
thermoprint-9e17810329dbfa0adc0ee3042556fbd13f810d5c.zip
test for safer deletion
Diffstat (limited to 'server/test/Thermoprint')
-rw-r--r--server/test/Thermoprint/ServerSpec.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/server/test/Thermoprint/ServerSpec.hs b/server/test/Thermoprint/ServerSpec.hs
index 8af210d..334f785 100644
--- a/server/test/Thermoprint/ServerSpec.hs
+++ b/server/test/Thermoprint/ServerSpec.hs
@@ -42,6 +42,7 @@ import System.IO.Temp
42import qualified Data.Text as T 42import qualified Data.Text as T
43 43
44import Network.Wai.Handler.Warp (defaultSettings, setBeforeMainLoop) 44import Network.Wai.Handler.Warp (defaultSettings, setBeforeMainLoop)
45import Network.HTTP.Types.Status (Status(..))
45 46
46import qualified Data.Map as Map 47import qualified Data.Map as Map
47 48
@@ -153,7 +154,11 @@ spec = withSetup $ do
153 (atomically . takeTMVar $ outputChan printer) `shouldReturn` p 154 (atomically . takeTMVar $ outputChan printer) `shouldReturn` p
154 draftDelete dId 155 draftDelete dId
155 drafts `shouldReturn` [] 156 drafts `shouldReturn` []
157 draftReplace dId Nothing p `shouldThrow` is404
156 where 158 where
157 Client{..} = mkClient' $ BaseUrl Http "localhost" 3000 "" 159 Client{..} = mkClient' $ BaseUrl Http "localhost" 3000 ""
160 is404 :: ServantError -> Bool
161 is404 e@(FailureResponse {}) = statusCode (responseStatus e) == 404
162 is404 _ = False
158 163
159 164