aboutsummaryrefslogtreecommitdiff
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
parent6831491b904403beb7fd3899b28e0deaa86d767d (diff)
downloadthermoprint-9e17810329dbfa0adc0ee3042556fbd13f810d5c.tar
thermoprint-9e17810329dbfa0adc0ee3042556fbd13f810d5c.tar.gz
thermoprint-9e17810329dbfa0adc0ee3042556fbd13f810d5c.tar.bz2
thermoprint-9e17810329dbfa0adc0ee3042556fbd13f810d5c.tar.xz
thermoprint-9e17810329dbfa0adc0ee3042556fbd13f810d5c.zip
test for safer deletion
-rw-r--r--server/test/Thermoprint/ServerSpec.hs5
-rw-r--r--server/thermoprint-server.cabal1
2 files changed, 6 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
diff --git a/server/thermoprint-server.cabal b/server/thermoprint-server.cabal
index afb62db..259abf3 100644
--- a/server/thermoprint-server.cabal
+++ b/server/thermoprint-server.cabal
@@ -93,6 +93,7 @@ Test-Suite tests
93 , exceptions >=0.8.0 && <1 93 , exceptions >=0.8.0 && <1
94 , containers >=0.5.6 && <1 94 , containers >=0.5.6 && <1
95 , async >=2.1.0 && <3 95 , async >=2.1.0 && <3
96 , http-types >=0.9.1 && <1
96 97
97executable thermoprint-server 98executable thermoprint-server
98 main-is: Main.hs 99 main-is: Main.hs