From 7258af44c38f597c58b1278556b0c24d14cc4d9a Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Sat, 12 Aug 2023 21:17:42 -0500 Subject: [PATCH] Enable the config file in test suite --- test/Spec.hs | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/test/Spec.hs b/test/Spec.hs index 264d458..e493d88 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -1211,17 +1211,40 @@ unwrapDoc _ = [] startAPI :: Config -> IO () startAPI config = do putStrLn "Starting test server ..." - pipe <- connect $ host "127.0.0.1" - c <- access pipe master "zgo" (auth "zgo" "zcashrules") + pipe <- connect $ host $ c_dbHost config + c <- access pipe master "zgo" (auth (c_dbUser config) (c_dbPassword config)) let appRoutes = routes pipe config _ <- forkIO (scotty 3000 appRoutes) _ <- - access pipe master "test" (Database.MongoDB.delete (select [] "wootokens")) - _ <- access pipe master "test" (Database.MongoDB.delete (select [] "users")) - _ <- access pipe master "test" (Database.MongoDB.delete (select [] "items")) - _ <- access pipe master "test" (Database.MongoDB.delete (select [] "orders")) + access + pipe + master + (c_dbName config) + (Database.MongoDB.delete (select [] "wootokens")) _ <- - access pipe master "test" (Database.MongoDB.delete (select [] "xerotokens")) + access + pipe + master + (c_dbName config) + (Database.MongoDB.delete (select [] "users")) + _ <- + access + pipe + master + (c_dbName config) + (Database.MongoDB.delete (select [] "items")) + _ <- + access + pipe + master + (c_dbName config) + (Database.MongoDB.delete (select [] "orders")) + _ <- + access + pipe + master + (c_dbName config) + (Database.MongoDB.delete (select [] "xerotokens")) let myUser = User (Just (read "6272a90f2b05a74cf1000001" :: ObjectId))