diff options
author | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-07-18 12:22:23 +0200 |
---|---|---|
committer | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-07-18 12:22:23 +0200 |
commit | 9e17810329dbfa0adc0ee3042556fbd13f810d5c (patch) | |
tree | e213225286891369211b51c793bc55633298229e /server | |
parent | 6831491b904403beb7fd3899b28e0deaa86d767d (diff) | |
download | thermoprint-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')
-rw-r--r-- | server/test/Thermoprint/ServerSpec.hs | 5 | ||||
-rw-r--r-- | server/thermoprint-server.cabal | 1 |
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 | |||
42 | import qualified Data.Text as T | 42 | import qualified Data.Text as T |
43 | 43 | ||
44 | import Network.Wai.Handler.Warp (defaultSettings, setBeforeMainLoop) | 44 | import Network.Wai.Handler.Warp (defaultSettings, setBeforeMainLoop) |
45 | import Network.HTTP.Types.Status (Status(..)) | ||
45 | 46 | ||
46 | import qualified Data.Map as Map | 47 | import 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 | ||
97 | executable thermoprint-server | 98 | executable thermoprint-server |
98 | main-is: Main.hs | 99 | main-is: Main.hs |