diff --git a/PaymentServer.cabal b/PaymentServer.cabal index 60a849cb6bfef8854e9a11cc9e09d1aedad5ec0f..56d7c013c6bb0ec8b54d3506d5d9e0c64ddb7347 100644 --- a/PaymentServer.cabal +++ b/PaymentServer.cabal @@ -33,11 +33,12 @@ library , containers , cryptonite default-language: Haskell2010 + ghc-options: -Wmissing-import-lists -Wunused-imports executable PaymentServer-exe hs-source-dirs: app main-is: Main.hs - ghc-options: -threaded -rtsopts -with-rtsopts=-N + ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wmissing-import-lists -Wunused-imports build-depends: base , PaymentServer default-language: Haskell2010 @@ -78,7 +79,7 @@ test-suite PaymentServer-test , containers , unordered-containers , ilist - ghc-options: -threaded -rtsopts -with-rtsopts=-N + ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wmissing-import-lists -Wunused-imports default-language: Haskell2010 source-repository head diff --git a/src/PaymentServer/Redemption.hs b/src/PaymentServer/Redemption.hs index 1d0593cd593867cd2a5b3bc29eccb14c39627c69..23dfbc849b6699f61d1be229d85e3f7ae3535766 100644 --- a/src/PaymentServer/Redemption.hs +++ b/src/PaymentServer/Redemption.hs @@ -25,7 +25,6 @@ import Data.Text ) import Data.Text.Encoding ( encodeUtf8 - , decodeUtf8 ) import Data.Aeson ( ToJSON(toJSON, toEncoding) diff --git a/src/PaymentServer/Server.hs b/src/PaymentServer/Server.hs index bd51423c3f9a5c9f980ef63da38776cde47a738c..5b7f52eb73b27914aaa8bea1e4bef89f7fa2c70f 100644 --- a/src/PaymentServer/Server.hs +++ b/src/PaymentServer/Server.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE TypeOperators #-} @@ -38,4 +37,4 @@ paymentServerAPI = Proxy -- | Create a Servant Application which serves the payment server API using -- the given database. paymentServerApp :: VoucherDatabase d => d -> Application -paymentServerApp = (serve paymentServerAPI) . paymentServer +paymentServerApp = serve paymentServerAPI . paymentServer diff --git a/test/SpecRedemption.hs b/test/SpecRedemption.hs index ba4bf06dac3f96871112e51bff58e689c3a97870..e9c05108d596bfc232cb7cf749026960587212db 100644 --- a/test/SpecRedemption.hs +++ b/test/SpecRedemption.hs @@ -11,12 +11,8 @@ import Data.ByteString import Text.Printf ( printf ) -import Control.Exception - ( bracket - ) import Data.Aeson - ( FromJSON - , decode + ( decode , encode ) import Servant @@ -29,10 +25,6 @@ import Test.Hspec , parallel , describe , it - , before - , around - , shouldReturn - , shouldBe , runIO ) import Network.HTTP.Types @@ -51,13 +43,6 @@ import Test.Hspec.Wai import Test.Hspec.Wai.QuickCheck ( property ) -import Test.QuickCheck - ( Property - , (==>) - ) -import Test.QuickCheck.Monadic - ( pre - ) import Test.QuickCheck.Instances.Text () import Util.Spec ( wrongMethodNotAllowed @@ -77,9 +62,7 @@ import PaymentServer.Redemption import PaymentServer.Persistence ( RedeemError(NotPaid) , Voucher - , Fingerprint , VoucherDatabase(payForVoucher, redeemVoucher) - , MemoryVoucherDatabase , memory ) @@ -141,7 +124,7 @@ spec_redemption = parallel $ do describe "redemption" $ do - with (return . app $ RefuseRedemption NotPaid) $ do + with (return . app $ RefuseRedemption NotPaid) $ it "receives a failure response when the voucher is not paid" $ property $ \(voucher :: Voucher) (tokens :: [BlindedToken]) -> propertyRedeem path voucher tokens 400 @@ -152,7 +135,7 @@ spec_redemption = parallel $ do , matchHeaders = ["Content-Type" <:> "application/json;charset=utf-8"] } - with (return $ app PermitRedemption) $ do + with (return $ app PermitRedemption) $ it "receive a success response when redemption succeeds" $ property $ \(voucher :: Voucher) (tokens :: [BlindedToken]) -> propertyRedeem path voucher tokens 200