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/test | |
| 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/test')
| -rw-r--r-- | server/test/Thermoprint/ServerSpec.hs | 5 |
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 | |||
| 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 | ||
