From 9d7a9f2b2a99a4c4d805556db60cce7df6a53453 Mon Sep 17 00:00:00 2001 From: Astro Date: Fri, 5 Jun 2020 18:28:46 +0200 Subject: [PATCH 1/8] update for newer ghc+yesod --- Handler/Common.hs | 3 +-- Settings.hs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Handler/Common.hs b/Handler/Common.hs index cb35dda..ce06c17 100644 --- a/Handler/Common.hs +++ b/Handler/Common.hs @@ -217,9 +217,8 @@ sendMail to subject body = , mailParts =[[Part { partType = "text/plain; charset=utf-8" , partEncoding = None - , partFilename = Nothing , partHeaders = [] - , partContent = E.encodeUtf8 body + , partContent = PartContent $ E.encodeUtf8 body }]] } diff --git a/Settings.hs b/Settings.hs index 37f1435..22cd795 100644 --- a/Settings.hs +++ b/Settings.hs @@ -20,7 +20,7 @@ -- declared in the Foundation.hs file. module Settings where -import ClassyPrelude.Yesod hiding (throw) +import ClassyPrelude.Yesod import Control.Exception (throw) import Data.Aeson (Result (..), fromJSON, withObject, (.!=), (.:?)) From 46d9cfd81e2a73f5723cd6ebb5642795d312df88 Mon Sep 17 00:00:00 2001 From: Astro Date: Fri, 5 Jun 2020 18:37:19 +0200 Subject: [PATCH 2/8] TestImport: fix dup export --- test/TestImport.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/TestImport.hs b/test/TestImport.hs index bd647a6..75d8741 100644 --- a/test/TestImport.hs +++ b/test/TestImport.hs @@ -4,7 +4,7 @@ module TestImport ) where import Application (makeFoundation) -import ClassyPrelude as X +import ClassyPrelude as X hiding (Handler) import Database.Persist as X hiding (get) import Database.Persist.Sql (SqlPersistM, runSqlPersistMPool) import Foundation as X From 4b91f54e3e8aa498b812fff62106588df7b2e3fe Mon Sep 17 00:00:00 2001 From: Astro Date: Fri, 5 Jun 2020 18:56:13 +0200 Subject: [PATCH 3/8] more updates --- test/Handler/HomeSpec.hs | 2 +- test/TestImport.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Handler/HomeSpec.hs b/test/Handler/HomeSpec.hs index 2b6abbe..e0102f6 100755 --- a/test/Handler/HomeSpec.hs +++ b/test/Handler/HomeSpec.hs @@ -12,7 +12,7 @@ spec = withApp $ do request $ do setMethod "POST" setUrl HomeR - addNonce + addToken fileByLabel "Choose a file" "test/Spec.hs" "text/plain" -- talk about self-reference byLabel "What's on the file?" "Some Content" diff --git a/test/TestImport.hs b/test/TestImport.hs index 75d8741..0cb65c7 100644 --- a/test/TestImport.hs +++ b/test/TestImport.hs @@ -5,7 +5,7 @@ module TestImport import Application (makeFoundation) import ClassyPrelude as X hiding (Handler) -import Database.Persist as X hiding (get) +import Database.Persist as X hiding (get, delete, deleteBy) import Database.Persist.Sql (SqlPersistM, runSqlPersistMPool) import Foundation as X import Model as X From 98d709752d0303d0ac69a05adf2defb5cdbd34de Mon Sep 17 00:00:00 2001 From: Astro Date: Fri, 5 Jun 2020 18:56:22 +0200 Subject: [PATCH 4/8] .cabal: list test modules --- yammat.cabal | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/yammat.cabal b/yammat.cabal index d7e74d3..2b64161 100644 --- a/yammat.cabal +++ b/yammat.cabal @@ -164,6 +164,12 @@ test-suite test ViewPatterns TupleSections + other-modules: Handler.CommonSpec + Handler.HomeSpec + Handler.SupplierActionsSpec + Handler.SupplierSpec + TestImport + build-depends: base , yammat , yesod-test >= 1.4.2 From cd6676944dce85ea494642a3cfa22f46160188a2 Mon Sep 17 00:00:00 2001 From: Astro Date: Fri, 5 Jun 2020 19:18:43 +0200 Subject: [PATCH 5/8] TestImport: update withApp type --- test/TestImport.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/TestImport.hs b/test/TestImport.hs index 0cb65c7..3f00ccb 100644 --- a/test/TestImport.hs +++ b/test/TestImport.hs @@ -18,10 +18,10 @@ runDB query = do pool <- fmap appConnPool getTestYesod liftIO $ runSqlPersistMPool query pool -withApp :: SpecWith App -> Spec +withApp :: SpecWith (App, a -> a) -> Spec withApp = before $ do settings <- loadAppSettings ["config/test-settings.yml", "config/settings.yml"] [] ignoreEnv - makeFoundation settings + (, id) <$> makeFoundation settings From d913465154e8c168f80a113a5dadbea3e0dd8069 Mon Sep 17 00:00:00 2001 From: Astro Date: Fri, 5 Jun 2020 19:28:14 +0200 Subject: [PATCH 6/8] test: fix pending signatures --- test/Handler/SupplierActionsSpec.hs | 7 +++---- test/Handler/SupplierSpec.hs | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/test/Handler/SupplierActionsSpec.hs b/test/Handler/SupplierActionsSpec.hs index 0741207..1cdd3c8 100755 --- a/test/Handler/SupplierActionsSpec.hs +++ b/test/Handler/SupplierActionsSpec.hs @@ -3,8 +3,7 @@ module Handler.SupplierActionsSpec (spec) where import TestImport spec :: Spec -spec = withApp $ do - +spec = describe "getSupplierActionsR" $ do - error "Spec not implemented: getSupplierActionsR" - + xit "Spec not implemented: getSupplierActionsR" $ do + pending diff --git a/test/Handler/SupplierSpec.hs b/test/Handler/SupplierSpec.hs index 23f8d34..75b5ec0 100755 --- a/test/Handler/SupplierSpec.hs +++ b/test/Handler/SupplierSpec.hs @@ -3,8 +3,7 @@ module Handler.SupplierSpec (spec) where import TestImport spec :: Spec -spec = withApp $ do - +spec = describe "getSupplierR" $ do - error "Spec not implemented: getSupplierR" - + xit "Spec not implemented: getSupplierR" $ do + pending From 90108556cad3c103ddced0a0c7d52dff781d54f1 Mon Sep 17 00:00:00 2001 From: Astro Date: Fri, 5 Jun 2020 19:28:46 +0200 Subject: [PATCH 7/8] default.nix: disable tests they require a running postgresql instance which is atm not available in a nix-build sandbox. --- default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/default.nix b/default.nix index 119fd7d..1c4872a 100644 --- a/default.nix +++ b/default.nix @@ -34,5 +34,6 @@ mkDerivation { persistent persistent-mysql resourcet transformers yesod yesod-core yesod-test ]; + doCheck = false; license = stdenv.lib.licenses.agpl3; } From faad483f004d679f5815f84f64d2d2bf999b7c91 Mon Sep 17 00:00:00 2001 From: Astro Date: Fri, 5 Jun 2020 19:44:25 +0200 Subject: [PATCH 8/8] default.nix: don't build docs it's broken --- default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/default.nix b/default.nix index 1c4872a..98a7266 100644 --- a/default.nix +++ b/default.nix @@ -35,5 +35,6 @@ mkDerivation { yesod-test ]; doCheck = false; + doHaddock = false; license = stdenv.lib.licenses.agpl3; }