packages feed

haskell-neo4j-client 0.3.1.4 → 0.3.2.0

raw patch · 6 files changed

+270/−194 lines, 6 filesdep +http-clientPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: http-client

API changes (from Hackage documentation)

+ Database.Neo4j: getDatabaseVersion :: Neo4j Version
+ Database.Neo4j: newAuthConnection :: Hostname -> Port -> Credentials -> IO Connection
+ Database.Neo4j: type Credentials = (Username, Password)
+ Database.Neo4j: withAuthConnection :: Hostname -> Port -> Credentials -> Neo4j a -> IO a
+ Database.Neo4j.Types: dbCredentials :: Connection -> Maybe Credentials
+ Database.Neo4j.Types: getPassword :: Credentials -> ByteString
+ Database.Neo4j.Types: getUsername :: Credentials -> ByteString
+ Database.Neo4j.Types: instance FromJSON Version
+ Database.Neo4j.Types: type Credentials = (Username, Password)
+ Database.Neo4j.Types: type Password = ByteString
+ Database.Neo4j.Types: type Username = ByteString
- Database.Neo4j.Types: Connection :: Hostname -> Port -> Manager -> Connection
+ Database.Neo4j.Types: Connection :: Hostname -> Port -> Manager -> Maybe Credentials -> Connection

Files

haskell-neo4j-client.cabal view
@@ -1,5 +1,5 @@ name:                haskell-neo4j-client-version:             0.3.1.4+version:             0.3.2.0 synopsis:            A Haskell neo4j client description:              Library to interact with Neo4j databases. @@ -14,10 +14,9 @@     .        -Traversal API     .-    All code has been tested with Neo4j versions 2.0.3, 2.1.5, 2.1.7, 2.2.0 and 2.2.1+       -Authentication     .-    2.2.0 added authentication to the API this driver uses, this is not supported yet by this driver but it will be soon.-    In the meantime you will have to disable it.+    All code has been tested with Neo4j versions 2.0.3, 2.1.5, 2.1.7, 2.2.0 and 2.2.1 homepage:            https://github.com/asilvestre/haskell-neo4j-rest-client license:             MIT license-file:        LICENSE@@ -47,6 +46,7 @@                    , HUnit                       >= 1.2                    , Cabal                    , text                        >= 1.1+                   , http-client                 >= 0.4                    , http-conduit                >= 2.1                    , http-types                  >= 0.8                    , resourcet                   >= 1.1@@ -69,12 +69,15 @@   exposed-modules:     Database.Neo4j, Database.Neo4j.Graph, Database.Neo4j.Batch, Database.Neo4j.Cypher,                        Database.Neo4j.Transactional.Cypher, Database.Neo4j.Types, Database.Neo4j.Traversal   other-modules:       Database.Neo4j.Http, Database.Neo4j.Node, Database.Neo4j.Relationship,-                       Database.Neo4j.Property, Database.Neo4j.Label, Database.Neo4j.Index, Database.Neo4j.Batch.Node,-                       Database.Neo4j.Batch.Relationship, Database.Neo4j.Batch.Property,-                       Database.Neo4j.Batch.Label, Database.Neo4j.Batch.Types+                       Database.Neo4j.Property, Database.Neo4j.Label, Database.Neo4j.Index, +                       Database.Neo4j.Version,+                       Database.Neo4j.Batch.Node, Database.Neo4j.Batch.Relationship, +                       Database.Neo4j.Batch.Property, Database.Neo4j.Batch.Label, +                       Database.Neo4j.Batch.Types   build-depends:       base                  == 4.*                      , containers            >= 0.5                      , text                  >= 1.1+                     , http-client           >= 0.4                      , http-conduit          >= 2.1                      , http-types            >= 0.8                      , bytestring            >= 0.10
src/Database/Neo4j.hs view
@@ -16,7 +16,7 @@     -- $use      -- * Connection handling objects-    Connection, Hostname, Port, newConnection, withConnection,+    Connection, Hostname, Port, Credentials, newConnection, withConnection, newAuthConnection, withAuthConnection,     -- * Main monadic type to handle sequences of commands to Neo4j     Neo4j(..),     -- * Constructing and managing node/relationship properties@@ -35,16 +35,19 @@     -- * Indexes     Index(..), createIndex, getIndexes, dropIndex,     -- * Exceptions-    Neo4jException(..)+    Neo4jException(..),+    -- * Database version information+    getDatabaseVersion,     ) where -import Database.Neo4j.Index import Database.Neo4j.Http+import Database.Neo4j.Index import Database.Neo4j.Label import Database.Neo4j.Node-import Database.Neo4j.Relationship import Database.Neo4j.Property+import Database.Neo4j.Relationship import Database.Neo4j.Types+import Database.Neo4j.Version  -- $use --
src/Database/Neo4j/Http.hs view
@@ -11,6 +11,10 @@ import Data.Aeson ((.:)) import Data.Aeson.Types (parseMaybe) +import Network.HTTP.Client (defaultManagerSettings)++import Text.ParserCombinators.ReadP+ import qualified Data.Aeson as J import qualified Data.ByteString as S import qualified Data.ByteString.Lazy as L@@ -20,22 +24,36 @@  import Database.Neo4j.Types - -- | Create a new connection that can be manually closed with runResourceT newConnection :: Hostname -> Port -> IO Connection newConnection hostname port = do-        mgr <- HC.newManager HC.conduitManagerSettings-        return $ Connection hostname port mgr+        mgr <- HC.newManager defaultManagerSettings+        return $ Connection hostname port mgr Nothing +-- | Create a new connection that can be manually closed with runResourceT using provided credentials for basic auth+newAuthConnection :: Hostname -> Port -> Credentials -> IO Connection+newAuthConnection hostname port creds = do+        mgr <- HC.newManager defaultManagerSettings+        return $ Connection hostname port mgr (Just creds)+ -- | Run a set of Neo4j commands in a single connection-withConnection :: Hostname -> Port -> Neo4j a -> IO a -withConnection hostname port cmds = runResourceT $ HC.withManager $-         \mgr -> liftIO $ runNeo4j cmds $ Connection hostname port mgr-        +withConnection :: Hostname -> Port -> Neo4j a -> IO a+withConnection hostname port cmds = runResourceT $ do+         mgr <- liftIO $ HC.newManager defaultManagerSettings+         let conn = Connection hostname port mgr Nothing+         liftIO $ runNeo4j cmds conn++-- | Run a set of Neo4j commands in a single connection using provided credentials for basic auth+withAuthConnection :: Hostname -> Port -> Credentials -> Neo4j a -> IO a+withAuthConnection hostname port creds cmds = runResourceT $ do+         mgr <- liftIO $ HC.newManager defaultManagerSettings+         let conn = Connection hostname port mgr (Just creds)+         liftIO $ runNeo4j cmds conn+        -- | General function for HTTP requests httpReq :: Connection -> HT.Method -> S.ByteString -> L.ByteString -> (HT.Status -> Bool) ->      IO (HC.Response L.ByteString)-httpReq (Connection h p m) method path body statusCheck = do+httpReq (Connection h p m c) method path body statusCheck = do             let request = def {                     HC.host = h,                     HC.port = p,@@ -49,10 +67,12 @@                                           (HT.hContentType, "application/json")]}             -- TODO: Would be better to use exceptions package Control.Monad.Catch ??             -- Wrapping up HTTP-Conduit exceptions in our own-            liftIO $ HC.httpLbs request m `catch` wrapException+            liftIO $ case c of +                Nothing -> HC.httpLbs request m `catch` wrapException+                Just creds -> HC.httpLbs (HC.applyBasicAuth (getUsername creds) (getPassword creds) request) m `catch` wrapException     where wrapException :: HC.HttpException -> a           wrapException = throw . Neo4jHttpException . show-+     -- | Extracts the exception description from a HTTP Neo4j response if the status code matches otherwise Nothing extractException :: HC.Response L.ByteString -> T.Text extractException resp = fromMaybe "" $ do
src/Database/Neo4j/Types.hs view
@@ -14,6 +14,7 @@ import Data.Monoid (Monoid, mappend) import Data.String (fromString) import Data.Typeable (Typeable)+import Data.Version import Control.Exception (throw) import Control.Exception.Base (Exception) import Control.Applicative@@ -22,6 +23,7 @@ import Control.Monad.IO.Class (MonadIO, liftIO) --import Control.Monad.Trans.Control (MonadBaseControl, liftBaseWith, restoreM, StM) import Control.Monad.Trans.Resource (MonadThrow, throwM)+import Text.ParserCombinators.ReadP import GHC.Generics (Generic)  import Data.Aeson ((.:))@@ -318,11 +320,26 @@ instance Exception Neo4jException  -- | Type for a connection-data Connection = Connection {dbHostname :: Hostname, dbPort :: Port, manager :: HC.Manager}+data Connection = Connection {dbHostname :: Hostname+                             ,dbPort :: Port+                             ,manager :: HC.Manager+                             ,dbCredentials :: Maybe Credentials+                             }  type Hostname = S.ByteString type Port = Int +type Credentials = (Username, Password)+type Username = S.ByteString+type Password = S.ByteString++getUsername :: Credentials -> S.ByteString+getUsername = fst++getPassword :: Credentials -> S.ByteString+getPassword = snd++ -- | Neo4j monadic type to be able to sequence neo4j commands in a connection newtype Neo4j a = Neo4j { runNeo4j :: Connection -> IO a } @@ -359,3 +376,8 @@ --         liftBaseWith $ \runInBase -> --             f $ liftM StNeo4j . runInBase . (\(Neo4j r) -> r conn) --    restoreM (StNeo4j x) = Neo4j $ const $ restoreM x++instance J.FromJSON Version where+    parseJSON (J.Object v) = v .: "neo4j_version" >>= (\s -> return $ fst . last $ readP_to_S parseVersion s)+    parseJSON _ = mzero+
+ src/Database/Neo4j/Version.hs view
@@ -0,0 +1,11 @@+{-# LANGUAGE OverloadedStrings  #-}++module Database.Neo4j.Version where++import Data.Version++import Database.Neo4j.Http+import Database.Neo4j.Types++getDatabaseVersion :: Neo4j Version+getDatabaseVersion = Neo4j $ \conn -> httpRetrieveSure conn "/db/data"
tests/IntegrationTests.hs view
@@ -83,6 +83,9 @@ host :: Hostname host = "localhost" +creds :: Credentials+creds = ("neo4j","test")+ someOtherProperties :: Properties someOtherProperties = M.fromList ["hola" |: ("adeu" :: T.Text), "proparray" |: ["a" :: T.Text, "", "adeu"]] @@ -96,12 +99,26 @@ -- | Test connecting to a non-existing server case_NoConnection :: Assertion case_NoConnection = assertException expException $ withConnection "localhost" 77 $ createNode someProperties-    where expException = Neo4jHttpException "FailedConnectionException2 \"localhost\" 77 False connect: does\-                                             \ not exist (Connection refused)"+    where expException = Neo4jHttpException "FailedConnectionException2 \"localhost\" 77 False connect: does not exist (Connection refused)" +-- | Test connecting to a server with improper credentials+case_ImproperCredentials :: Assertion+case_ImproperCredentials = do+    mExp <- getException $ withConnection host port $ createNode someProperties+    case mExp of+        Nothing -> return () -- Old Neo4j version or auth disabled, no need to test this+        Just _ -> assertException expException (+            withAuthConnection host port ("fake", "pass") $ createNode someProperties)+    where expException = Neo4jUnexpectedResponseException HT.status401++-- | Test getDatabaseVersion+case_getDatabaseVersion :: Assertion+case_getDatabaseVersion = do +    withAuthConnection host port creds $ getDatabaseVersion >> return ()+ -- | Test get and create a node case_CreateGetDeleteNode :: Assertion-case_CreateGetDeleteNode = withConnection host port $ do+case_CreateGetDeleteNode = withAuthConnection host port creds $ do     n <- createNode someProperties     newN <- getNode n     neo4jEqual (Just n) newN@@ -109,7 +126,7 @@  -- | Test delete and get a node case_CreateDeleteGetNode :: Assertion-case_CreateDeleteGetNode = withConnection host port $ do+case_CreateDeleteGetNode = withAuthConnection host port creds $ do     n <- createNode someProperties     deleteNode n     newN <- getNode n@@ -117,14 +134,14 @@  -- | Test double delete case_DoubleDeleteNode :: Assertion-case_DoubleDeleteNode = withConnection host port $ do+case_DoubleDeleteNode = withAuthConnection host port creds $ do     n <- createNode someProperties     deleteNode n     deleteNode n  -- | Test get node by id case_GetNodeById :: Assertion-case_GetNodeById = withConnection host port $ do+case_GetNodeById = withAuthConnection host port creds $ do     n <- createNode someProperties     newN <- getNode (nodeId n)     neo4jEqual (Just n) newN@@ -132,23 +149,23 @@  -- | Test get node with unexisting id case_GetUnexistingNodeById :: Assertion-case_GetUnexistingNodeById = withConnection host port $ do+case_GetUnexistingNodeById = withAuthConnection host port creds $ do     newN <- getNode ("unexistingnode" :: S.ByteString)     neo4jEqual Nothing newN          -- | Test delete node by id case_DeleteNodeById :: Assertion-case_DeleteNodeById = withConnection host port $ do+case_DeleteNodeById = withAuthConnection host port creds $ do     n <- createNode someProperties     deleteNode (nodeId n)  -- | Test delete unexisting node by id case_DeleteUnexistingNodeById :: Assertion-case_DeleteUnexistingNodeById = withConnection host port $ deleteNode ("unexistingnode" :: S.ByteString)+case_DeleteUnexistingNodeById = withAuthConnection host port creds $ deleteNode ("unexistingnode" :: S.ByteString)  -- | Refresh node properties from the DB case_getNodeProperties :: Assertion-case_getNodeProperties = withConnection host port $ do+case_getNodeProperties = withAuthConnection host port creds $ do     n <- createNode someProperties     props <- getProperties n     neo4jEqual someProperties props@@ -157,15 +174,15 @@ -- | Get node properties from a deleted node case_getDeletedNodeProperties :: Assertion case_getDeletedNodeProperties = do-        n <- withConnection host port $ createNode someProperties+        n <- withAuthConnection host port creds $ createNode someProperties         let expException = Neo4jNoEntityException $ runNodeIdentifier n-        assertException expException $ withConnection host port $ do+        assertException expException $ withAuthConnection host port creds $ do             deleteNode n             getProperties n  -- | Get a property from a node case_getNodeProperty :: Assertion-case_getNodeProperty = withConnection host port $ do+case_getNodeProperty = withAuthConnection host port creds $ do     n <- createNode someProperties     prop <- getProperty n "intarray"     neo4jEqual (M.lookup "intarray" someProperties) prop@@ -173,7 +190,7 @@  -- | Get an unexisting property from a node case_getNodeUnexistingProperty :: Assertion-case_getNodeUnexistingProperty = withConnection host port $ do+case_getNodeUnexistingProperty = withAuthConnection host port creds $ do     n <- createNode someProperties     prop <- getProperty n "noproperty"     neo4jEqual Nothing prop@@ -182,16 +199,16 @@ -- | Get a property from an unexisting node case_getUnexistingNodeProperty :: Assertion case_getUnexistingNodeProperty = do-    n <- withConnection host port $ createNode someProperties+    n <- withAuthConnection host port creds $ createNode someProperties     let expException = Neo4jNoEntityException $ runNodeIdentifier n-    assertException expException $ withConnection host port $ do+    assertException expException $ withAuthConnection host port creds $ do         deleteNode n         _ <- getProperty n "noproperty"         return ()  -- | Get change the properties of a node case_changeNodeProperties :: Assertion-case_changeNodeProperties = withConnection host port $ do+case_changeNodeProperties = withAuthConnection host port creds $ do         n <- createNode someProperties         newN <- setProperties n otherProperties         neo4jEqual otherProperties (getNodeProperties newN)@@ -203,15 +220,15 @@ -- | Get change the properties of a node that doesn't exist case_changeUnexistingNodeProperties :: Assertion case_changeUnexistingNodeProperties = do-    n <- withConnection host port $ createNode someProperties+    n <- withAuthConnection host port creds $ createNode someProperties     let expException = Neo4jNoEntityException $ runNodeIdentifier n-    assertException expException $ withConnection host port $ do+    assertException expException $ withAuthConnection host port creds $ do         deleteNode n         setProperties n someProperties  -- | Change a property of a node case_changeNodeProperty :: Assertion-case_changeNodeProperty = withConnection host port $ do+case_changeNodeProperty = withAuthConnection host port creds $ do         n <- createNode someProperties         newN <- setProperty n otherValName otherVal         neo4jEqual otherProperties (getNodeProperties newN)@@ -224,7 +241,7 @@  -- | Change an array property of a node to empty case_changeNodePropertyToEmpty :: Assertion-case_changeNodePropertyToEmpty = withConnection host port $ do+case_changeNodePropertyToEmpty = withAuthConnection host port creds $ do         n <- createNode someProperties         newN <- setProperty n otherValName otherVal         neo4jEqual otherProperties (getNodeProperties newN)@@ -237,7 +254,7 @@  -- | Set an unexisting property of a node case_changeNodeUnexistingProperty :: Assertion-case_changeNodeUnexistingProperty = withConnection host port $ do+case_changeNodeUnexistingProperty = withAuthConnection host port creds $ do         n <- createNode someProperties         newN <- setProperty n otherValName otherVal         neo4jEqual otherProperties (getNodeProperties newN)@@ -251,9 +268,9 @@ -- | Set property of an unexisting node case_changeUnexistingNodeProperty :: Assertion case_changeUnexistingNodeProperty = do-    n <- withConnection host port $ createNode someProperties+    n <- withAuthConnection host port creds $ createNode someProperties     let expException = Neo4jNoEntityException $ runNodeIdentifier n-    assertException expException $ withConnection host port $ do+    assertException expException $ withAuthConnection host port creds $ do         deleteNode n         _ <- setProperty n otherValName otherVal         return ()@@ -262,7 +279,7 @@  -- | Delete node properties case_deleteNodeProperties :: Assertion-case_deleteNodeProperties = withConnection host port $ do+case_deleteNodeProperties = withAuthConnection host port creds $ do     n <- createNode someProperties     newN <- deleteProperties n     neo4jEqual M.empty (getNodeProperties newN)@@ -273,16 +290,16 @@ -- | Delete unexisting node properties case_deleteUnexistingNodeProperties :: Assertion case_deleteUnexistingNodeProperties = do-    n <- withConnection host port $ createNode someProperties+    n <- withAuthConnection host port creds $ createNode someProperties     let expException = Neo4jNoEntityException $ runNodeIdentifier n-    assertException expException $ withConnection host port $ do+    assertException expException $ withAuthConnection host port creds $ do         deleteNode n         _ <- deleteProperties n         return ()  -- | Delete a node property case_deleteNodeProperty :: Assertion-case_deleteNodeProperty = withConnection host port $ do+case_deleteNodeProperty = withAuthConnection host port creds $ do         n <- createNode someProperties         newN <- deleteProperty n valName         neo4jEqual otherProperties (getNodeProperties newN)@@ -294,7 +311,7 @@  -- | Delete an unexisting property from a node case_deleteNodeUnexistingProperty :: Assertion-case_deleteNodeUnexistingProperty = withConnection host port $ do+case_deleteNodeUnexistingProperty = withAuthConnection host port creds $ do         n <- createNode someProperties         newN <- deleteProperty n valName         neo4jEqual otherProperties (getNodeProperties newN)@@ -307,9 +324,9 @@ -- | Delete a property from an unexisting node case_deleteUnexistingNodeProperty :: Assertion case_deleteUnexistingNodeProperty = do-    n <- withConnection host port $ createNode someProperties+    n <- withAuthConnection host port creds $ createNode someProperties     let expException = Neo4jNoEntityException $ runNodeIdentifier n-    assertException expException $ withConnection host port $ do+    assertException expException $ withAuthConnection host port creds $ do         deleteNode n         _ <- deleteProperty n valName         return ()@@ -331,14 +348,14 @@ -- | Delete a node with a relationship case_deleteNodeWithRelationship :: Assertion case_deleteNodeWithRelationship = do-    (nodeFrom, nodeTo, r) <- withConnection host port setupRelTests+    (nodeFrom, nodeTo, r) <- withAuthConnection host port creds setupRelTests     let expException = Neo4jNonOrphanNodeDeletionException $ runNodeIdentifier nodeFrom-    assertException expException $ withConnection host port $ deleteNode nodeFrom-    withConnection host port $ teardownRelTests nodeFrom nodeTo r+    assertException expException $ withAuthConnection host port creds $ deleteNode nodeFrom+    withAuthConnection host port creds $ teardownRelTests nodeFrom nodeTo r      -- | Test get and create a relationship case_CreateGetDeleteRelationship :: Assertion-case_CreateGetDeleteRelationship = withConnection host port $ do+case_CreateGetDeleteRelationship = withAuthConnection host port creds $ do     (nodeFrom, nodeTo, r) <- setupRelTests     newN <- getRelationship r     neo4jEqual (Just r) newN@@ -346,7 +363,7 @@  -- | Test get all relationship properties case_allRelationshipProperties :: Assertion-case_allRelationshipProperties = withConnection host port $ do+case_allRelationshipProperties = withAuthConnection host port creds $ do     (nodeFrom, nodeTo, r) <- setupRelTests     rs <- allRelationshipTypes     neo4jBool $ myRelType `elem` rs@@ -354,7 +371,7 @@  -- | Test get the start and end of a relationship case_relationshipFromTo :: Assertion-case_relationshipFromTo = withConnection host port $ do+case_relationshipFromTo = withAuthConnection host port creds $ do     (nodeFrom, nodeTo, r) <- setupRelTests     nfrom <- getRelationshipFrom r     neo4jEqual nodeFrom nfrom@@ -365,60 +382,60 @@ -- | Test get the start of relationship that doesn't exist any more case_nonExistingRelationshipFrom :: Assertion case_nonExistingRelationshipFrom = do-    (nodeFrom, nodeTo, r) <- withConnection host port setupRelTests+    (nodeFrom, nodeTo, r) <- withAuthConnection host port creds setupRelTests     let expException = Neo4jNoEntityException $ runNodeIdentifier nodeFrom-    assertException expException $ withConnection host port $ do+    assertException expException $ withAuthConnection host port creds $ do         deleteRelationship r         deleteNode nodeFrom         n <- getRelationshipFrom r         neo4jEqual nodeFrom n -- Doing this to force the evaluation of n (the exception is thrown after parsing)         return ()-    withConnection host port $ teardownRelTests nodeFrom nodeTo r+    withAuthConnection host port creds $ teardownRelTests nodeFrom nodeTo r  -- | Test get the end of relationship that doesn't exist any more case_nonExistingRelationshipTo :: Assertion case_nonExistingRelationshipTo = do-    (nodeFrom, nodeTo, r) <- withConnection host port setupRelTests+    (nodeFrom, nodeTo, r) <- withAuthConnection host port creds setupRelTests     let expException = Neo4jNoEntityException $ runNodeIdentifier nodeTo-    assertException expException $ withConnection host port $ do+    assertException expException $ withAuthConnection host port creds $ do         deleteRelationship r         deleteNode nodeTo         n <- getRelationshipTo r         neo4jEqual nodeTo n -- Doing this to force the evaluation of n (the exception is thrown after parsing)         return ()-    withConnection host port $ teardownRelTests nodeFrom nodeTo r+    withAuthConnection host port creds $ teardownRelTests nodeFrom nodeTo r  -- | Create relationship with missing node from case_CreateRelationshipMissingFrom :: Assertion case_CreateRelationshipMissingFrom = do-    (nodeFrom, nodeTo) <- withConnection host port $ do+    (nodeFrom, nodeTo) <- withAuthConnection host port creds $ do         nodeFrom <- createNode anotherProperties         nodeTo <- createNode someOtherProperties         return (nodeFrom, nodeTo)     let expException = Neo4jNoEntityException $ runNodeIdentifier nodeFrom-    assertException expException $ withConnection host port $ do+    assertException expException $ withAuthConnection host port creds $ do         deleteNode nodeFrom         _ <- createRelationship myRelType someProperties nodeFrom nodeTo         return ()-    withConnection host port $ deleteNode nodeTo+    withAuthConnection host port creds $ deleteNode nodeTo  -- | Create relationship with missing node to case_CreateRelationshipMissingTo :: Assertion case_CreateRelationshipMissingTo = do-    (nodeFrom, nodeTo) <- withConnection host port $ do+    (nodeFrom, nodeTo) <- withAuthConnection host port creds $ do         nodeFrom <- createNode anotherProperties         nodeTo <- createNode someOtherProperties         return (nodeFrom, nodeTo)     let expException = Neo4jNoEntityException $ runNodeIdentifier nodeTo-    assertException expException $ withConnection host port $ do+    assertException expException $ withAuthConnection host port creds $ do         deleteNode nodeTo          _ <- createRelationship myRelType someProperties nodeFrom nodeTo         return ()-    withConnection host port $ deleteNode nodeFrom+    withAuthConnection host port creds $ deleteNode nodeFrom  -- | Test delete and get a relationship case_CreateDeleteGetRelationship :: Assertion-case_CreateDeleteGetRelationship = withConnection host port $ do+case_CreateDeleteGetRelationship = withAuthConnection host port creds $ do     (nodeFrom, nodeTo, r) <- setupRelTests     deleteRelationship r     newN <- getRelationship r@@ -427,7 +444,7 @@  -- | Test double delete case_DoubleDeleteRelationship :: Assertion-case_DoubleDeleteRelationship = withConnection host port $ do+case_DoubleDeleteRelationship = withAuthConnection host port creds $ do     (nodeFrom, nodeTo, r) <- setupRelTests     deleteRelationship r     deleteRelationship r@@ -435,7 +452,7 @@  -- | Test get relationship by id case_GetRelationshipById :: Assertion-case_GetRelationshipById = withConnection host port $ do+case_GetRelationshipById = withAuthConnection host port creds $ do     (nodeFrom, nodeTo, r) <- setupRelTests     newN <- getRelationship (relId r)     neo4jEqual (Just r) newN@@ -443,25 +460,25 @@  -- | Test get relationship with unexisting id case_GetUnexistingRelationshipById :: Assertion-case_GetUnexistingRelationshipById = withConnection host port $ do+case_GetUnexistingRelationshipById = withAuthConnection host port creds $ do     newN <- getRelationship ("unexistingrelationship" :: S.ByteString)     neo4jEqual Nothing newN          -- | Test delete relationship by id case_DeleteRelationshipById :: Assertion-case_DeleteRelationshipById = withConnection host port $ do+case_DeleteRelationshipById = withAuthConnection host port creds $ do     (nodeFrom, nodeTo, r) <- setupRelTests     deleteRelationship (relId r)     teardownRelTests nodeFrom nodeTo r  -- | Test delete unexisting relationship by id case_DeleteUnexistingRelationshipById :: Assertion-case_DeleteUnexistingRelationshipById = withConnection host port $ +case_DeleteUnexistingRelationshipById = withAuthConnection host port creds $          deleteRelationship ("unexistingrelationship" :: S.ByteString)  -- | Refresh relationship properties from the DB case_getRelationshipProperties :: Assertion-case_getRelationshipProperties = withConnection host port $ do+case_getRelationshipProperties = withAuthConnection host port creds $ do     (nodeFrom, nodeTo, r) <- setupRelTests     props <- getProperties r     neo4jEqual someProperties props@@ -470,9 +487,9 @@ -- | Get relationship properties from a deleted node case_getDeletedRelationshipProperties :: Assertion case_getDeletedRelationshipProperties = do-    (nodeFrom, nodeTo, r) <- withConnection host port setupRelTests+    (nodeFrom, nodeTo, r) <- withAuthConnection host port creds setupRelTests     let expException = Neo4jNoEntityException $ runRelIdentifier r-    assertException expException $ withConnection host port $ do+    assertException expException $ withAuthConnection host port creds $ do         deleteRelationship r         deleteNode nodeFrom         deleteNode nodeTo@@ -480,7 +497,7 @@  -- | Get a property from a relationship case_getRelationshipProperty :: Assertion-case_getRelationshipProperty = withConnection host port $ do+case_getRelationshipProperty = withAuthConnection host port creds $ do     (nodeFrom, nodeTo, r) <- setupRelTests     prop <- getProperty r "intarray"     neo4jEqual (M.lookup "intarray" someProperties) prop@@ -488,7 +505,7 @@  -- | Get an unexisting property from a relationship case_getRelationshipUnexistingProperty :: Assertion-case_getRelationshipUnexistingProperty = withConnection host port $ do+case_getRelationshipUnexistingProperty = withAuthConnection host port creds $ do     (nodeFrom, nodeTo, r) <- setupRelTests     prop <- getProperty r "noproperty"     neo4jEqual Nothing prop@@ -497,16 +514,16 @@ -- | Get a property from an unexisting relationship case_getUnexistingRelationshipProperty :: Assertion case_getUnexistingRelationshipProperty = do-    (nodeFrom, nodeTo, r) <- withConnection host port setupRelTests+    (nodeFrom, nodeTo, r) <- withAuthConnection host port creds setupRelTests     let expException = Neo4jNoEntityException $ runRelIdentifier r-    assertException expException $ withConnection host port $ do+    assertException expException $ withAuthConnection host port creds $ do         teardownRelTests nodeFrom nodeTo r         _ <- getProperty r "noproperty"         return ()  -- | Get change the properties of a relationship case_changeRelationshipProperties :: Assertion-case_changeRelationshipProperties = withConnection host port $ do+case_changeRelationshipProperties = withAuthConnection host port creds $ do         (nodeFrom, nodeTo, r) <- setupRelTests         newN <- setProperties r otherProperties         neo4jEqual otherProperties (getRelProperties newN)@@ -518,9 +535,9 @@ -- | Get change the properties of a relationship that doesn't exist case_changeUnexistingRelationshipProperties :: Assertion case_changeUnexistingRelationshipProperties = do-    (nodeFrom, nodeTo, r) <- withConnection host port setupRelTests+    (nodeFrom, nodeTo, r) <- withAuthConnection host port creds setupRelTests     let expException = Neo4jNoEntityException $ runRelIdentifier r-    assertException expException $ withConnection host port $ do+    assertException expException $ withAuthConnection host port creds $ do         deleteRelationship r         deleteNode nodeFrom         deleteNode nodeTo@@ -528,7 +545,7 @@  -- | Change a property of a relationship case_changeRelationshipProperty :: Assertion-case_changeRelationshipProperty = withConnection host port $ do+case_changeRelationshipProperty = withAuthConnection host port creds $ do         (nodeFrom, nodeTo, r) <- setupRelTests         newN <- setProperty r otherValName otherVal         neo4jEqual otherProperties (getRelProperties newN)@@ -541,7 +558,7 @@  -- | Change an array property of a relationship to empty case_changeRelationshipPropertyToEmpty :: Assertion-case_changeRelationshipPropertyToEmpty = withConnection host port $ do+case_changeRelationshipPropertyToEmpty = withAuthConnection host port creds $ do         (nodeFrom, nodeTo, r) <- setupRelTests         newN <- setProperty r otherValName otherVal         neo4jEqual otherProperties (getRelProperties newN)@@ -554,7 +571,7 @@  -- | Set an unexisting property of a relationship case_changeRelationshipUnexistingProperty :: Assertion-case_changeRelationshipUnexistingProperty = withConnection host port $ do+case_changeRelationshipUnexistingProperty = withAuthConnection host port creds $ do         (nodeFrom, nodeTo, r) <- setupRelTests         newN <- setProperty r otherValName otherVal         neo4jEqual otherProperties (getRelProperties newN)@@ -568,19 +585,19 @@ -- | Set property of an unexisting node case_changeUnexistingRelationshipProperty :: Assertion case_changeUnexistingRelationshipProperty = do-    (nodeFrom, nodeTo, r) <- withConnection host port setupRelTests+    (nodeFrom, nodeTo, r) <- withAuthConnection host port creds setupRelTests     let expException = Neo4jNoEntityException $ runRelIdentifier r-    assertException expException $ withConnection host port $ do+    assertException expException $ withAuthConnection host port creds $ do         deleteRelationship r         _ <- setProperty r otherValName otherVal         return ()-    withConnection host port $ teardownRelTests nodeFrom nodeTo r+    withAuthConnection host port creds $ teardownRelTests nodeFrom nodeTo r     where otherValName = "mynewbool"           otherVal = newval False  -- | Delete relationship properties case_deleteRelationshipProperties :: Assertion-case_deleteRelationshipProperties = withConnection host port $ do+case_deleteRelationshipProperties = withAuthConnection host port creds $ do     (nodeFrom, nodeTo, r) <- setupRelTests     newN <- deleteProperties r     neo4jEqual M.empty (getRelProperties newN)@@ -591,17 +608,17 @@ -- | Delete unexisting relationship properties case_deleteUnexistingRelationshipProperties :: Assertion case_deleteUnexistingRelationshipProperties = do-    (nodeFrom, nodeTo, r) <- withConnection host port setupRelTests+    (nodeFrom, nodeTo, r) <- withAuthConnection host port creds setupRelTests     let expException = Neo4jNoEntityException $ runRelIdentifier r -    assertException expException $ withConnection host port $ do+    assertException expException $ withAuthConnection host port creds $ do         deleteRelationship r         _ <- deleteProperties r         return ()-    withConnection host port $ teardownRelTests nodeFrom nodeTo r+    withAuthConnection host port creds $ teardownRelTests nodeFrom nodeTo r  -- | Delete a relationship property case_deleteRelationshipProperty :: Assertion-case_deleteRelationshipProperty = withConnection host port $ do+case_deleteRelationshipProperty = withAuthConnection host port creds $ do         (nodeFrom, nodeTo, r) <- setupRelTests         newN <- deleteProperty r valName         neo4jEqual otherProperties (getRelProperties newN)@@ -613,7 +630,7 @@  -- | Delete an unexisting property from a relationship case_deleteRelationshipUnexistingProperty :: Assertion-case_deleteRelationshipUnexistingProperty = withConnection host port $ do+case_deleteRelationshipUnexistingProperty = withAuthConnection host port creds $ do         (nodeFrom, nodeTo, r) <- setupRelTests         newN <- deleteProperty r valName         neo4jEqual otherProperties (getRelProperties newN)@@ -626,18 +643,18 @@ -- | Delete a property from an unexisting relationship case_deleteUnexistingRelationshipProperty :: Assertion case_deleteUnexistingRelationshipProperty = do-        (nodeFrom, nodeTo, r) <- withConnection host port setupRelTests+        (nodeFrom, nodeTo, r) <- withAuthConnection host port creds setupRelTests         let expException = Neo4jNoEntityException $ runRelIdentifier r -        assertException expException $ withConnection host port $ do+        assertException expException $ withAuthConnection host port creds $ do             deleteRelationship r             _ <- deleteProperty r valName             return ()-        withConnection host port $ teardownRelTests nodeFrom nodeTo r+        withAuthConnection host port creds $ teardownRelTests nodeFrom nodeTo r     where valName = "noproperty"  -- | Get relationships for a node case_GetNodeRelationships :: Assertion-case_GetNodeRelationships = withConnection host port $ do+case_GetNodeRelationships = withAuthConnection host port creds $ do         (nodeFrom, nodeTo, r) <- setupRelTests         -- test getting relationships for the origin node         rsAny <- getRelationships nodeFrom Any []@@ -658,16 +675,16 @@ -- | Get relationships for an unexisting node case_GetUnexistingNodeRelationships :: Assertion case_GetUnexistingNodeRelationships = do-        (nodeFrom, nodeTo, r) <- withConnection host port setupRelTests+        (nodeFrom, nodeTo, r) <- withAuthConnection host port creds setupRelTests         let expException = Neo4jNoEntityException $ runNodeIdentifier nodeFrom-        assertException expException $ withConnection host port $ do+        assertException expException $ withAuthConnection host port creds $ do             teardownRelTests nodeFrom nodeTo r             _ <- getRelationships nodeFrom Any []             return ()  -- | Get relationships for a node with multiple relationships case_GetNodeRelationshipsMultiple :: Assertion-case_GetNodeRelationshipsMultiple = withConnection host port $ do+case_GetNodeRelationshipsMultiple = withAuthConnection host port creds $ do         (nodeFrom, nodeTo, r) <- setupRelTests         r2 <- createRelationship myRelType someOtherProperties nodeTo nodeFrom         rsAny <- getRelationships nodeFrom Any []@@ -683,7 +700,7 @@  -- | Get relationships for a node with a type filter case_GetNodeRelationshipsWithType :: Assertion-case_GetNodeRelationshipsWithType = withConnection host port $ do+case_GetNodeRelationshipsWithType = withAuthConnection host port creds $ do         (nodeFrom, nodeTo, r) <- setupRelTests         rsAny <- getRelationships nodeFrom Any [myRelType]         neo4jEqual [r] rsAny@@ -691,7 +708,7 @@  -- | Get relationships for a node with an unexisting type filter case_GetNodeRelationshipsWithUnexistingType :: Assertion-case_GetNodeRelationshipsWithUnexistingType = withConnection host port $ do+case_GetNodeRelationshipsWithUnexistingType = withAuthConnection host port creds $ do         (nodeFrom, nodeTo, r) <- setupRelTests         rsAny <- getRelationships nodeFrom Any ["notype"]         neo4jEqual [] rsAny@@ -699,7 +716,7 @@  -- | Get relationships for a node with a type filter with multiple elements case_GetNodeRelationshipsWithTypes :: Assertion-case_GetNodeRelationshipsWithTypes = withConnection host port $ do+case_GetNodeRelationshipsWithTypes = withAuthConnection host port creds $ do         (nodeFrom, nodeTo, r) <- setupRelTests         -- Create another relationship with another type         r2 <- createRelationship type2 anotherProperties nodeTo nodeFrom@@ -713,7 +730,7 @@  -- | Get all labels in the DB (We don't have control of all the labels the DB has) case_getLabels :: Assertion-case_getLabels = withConnection host port $ do+case_getLabels = withAuthConnection host port creds $ do         n <- createNode someProperties         addLabels [lbl] n         lbls <- allLabels@@ -723,7 +740,7 @@  -- | Get labels for a node it doesn't have any case_getNodeLabelsWithNone :: Assertion-case_getNodeLabelsWithNone = withConnection host port $ do+case_getNodeLabelsWithNone = withAuthConnection host port creds $ do     n <- createNode someProperties     lbls <- getLabels n     neo4jEqual [] lbls@@ -732,16 +749,16 @@ -- | Get labels for an unexisting node case_getUnexistingNodeLabels :: Assertion case_getUnexistingNodeLabels = do-    n <- withConnection host port $ createNode someProperties+    n <- withAuthConnection host port creds $ createNode someProperties     let expException = Neo4jNoEntityException $ runNodeIdentifier n-    assertException expException $ withConnection host port $ do+    assertException expException $ withAuthConnection host port creds $ do         deleteNode n         _ <- getLabels n         return ()  -- | Add labels to a node and get them case_getAddAndGetNodeLabels :: Assertion-case_getAddAndGetNodeLabels = withConnection host port $ do+case_getAddAndGetNodeLabels = withAuthConnection host port creds $ do         n <- createNode someProperties         addLabels [lbl1, lbl2] n         addLabels [lbl3] n@@ -756,15 +773,15 @@ -- | Add labels to an unexisting node case_addUnexistingNodeLabels :: Assertion case_addUnexistingNodeLabels = do -    n <- withConnection host port $ createNode someProperties+    n <- withAuthConnection host port creds $ createNode someProperties     let expException = Neo4jNoEntityException $ runNodeIdentifier n-    assertException expException $ withConnection host port $ do+    assertException expException $ withAuthConnection host port creds $ do         deleteNode n         addLabels ["mylabel"] n  -- | Change node labels case_changeNodeLabels :: Assertion-case_changeNodeLabels = withConnection host port $ do+case_changeNodeLabels = withAuthConnection host port creds $ do         n <- createNode someProperties         addLabels [lbl1, lbl2] n         changeLabels [lbl3] n@@ -777,7 +794,7 @@  -- | Change node labels to empty case_changeNodeLabelsToEmpty :: Assertion-case_changeNodeLabelsToEmpty = withConnection host port $ do+case_changeNodeLabelsToEmpty = withAuthConnection host port creds $ do         n <- createNode someProperties         addLabels [lbl1, lbl2] n         changeLabels [] n@@ -790,15 +807,15 @@ -- | Change labels for an unexisting node case_changeUnexistingNodeLabels :: Assertion case_changeUnexistingNodeLabels = do -    n <- withConnection host port $ createNode someProperties+    n <- withAuthConnection host port creds $ createNode someProperties     let expException = Neo4jNoEntityException $ runNodeIdentifier n-    assertException expException $ withConnection host port $ do+    assertException expException $ withAuthConnection host port creds $ do         deleteNode n         changeLabels ["mylabel"] n  -- | Remove a label from a node case_removeNodeLabel :: Assertion-case_removeNodeLabel = withConnection host port $ do+case_removeNodeLabel = withAuthConnection host port creds $ do         n <- createNode someProperties         addLabels [lbl1, lbl2] n         removeLabel lbl1 n@@ -810,7 +827,7 @@  -- | Remove an unexisting label from a node (nothing should happen) case_removeNodeUnexistingLabel :: Assertion-case_removeNodeUnexistingLabel = withConnection host port $ do+case_removeNodeUnexistingLabel = withAuthConnection host port creds $ do         n <- createNode someProperties         addLabels [lbl1] n         removeLabel "nolabel" n@@ -822,15 +839,15 @@ -- | Remove label for an unexisting node case_removeUnexistingNodeLabel :: Assertion case_removeUnexistingNodeLabel = do -    n <- withConnection host port $ createNode someProperties+    n <- withAuthConnection host port creds $ createNode someProperties     let expException = Neo4jNoEntityException $ runNodeIdentifier n-    assertException expException $ withConnection host port $ do+    assertException expException $ withAuthConnection host port creds $ do         deleteNode n         removeLabel "mylabel" n  -- | Get all nodes with a label case_allNodesWithLabel :: Assertion-case_allNodesWithLabel = withConnection host port $ do+case_allNodesWithLabel = withAuthConnection host port creds $ do         n1 <- createNode someProperties         n2 <- createNode someProperties         n3 <- createNode someProperties@@ -848,7 +865,7 @@  -- | Get all nodes with a label and a property case_allNodesWithLabelAndProperty :: Assertion-case_allNodesWithLabelAndProperty = withConnection host port $ do+case_allNodesWithLabelAndProperty = withAuthConnection host port creds $ do         n1 <- createNode someProperties         n2 <- createNode someProperties         n3 <- createNode anotherProperties@@ -865,7 +882,7 @@  -- | Create, get and destroy index case_createGetDropIndex :: Assertion-case_createGetDropIndex = withConnection host port $ do+case_createGetDropIndex = withAuthConnection host port creds $ do         dropIndex lbl prop1         dropIndex lbl prop2         dropIndex lbl2 prop1@@ -895,7 +912,7 @@  -- | Test batch, create a node and get it again case_batchCreateGetNode :: Assertion-case_batchCreateGetNode = withConnection host port $ do+case_batchCreateGetNode = withAuthConnection host port creds $ do                 g <- B.runBatch $ do                         n <- B.createNode someProperties                         B.getNode n@@ -905,7 +922,7 @@  -- | Test batch, create two nodes in a batch case_batchCreate2Nodes :: Assertion-case_batchCreate2Nodes = withConnection host port $ do+case_batchCreate2Nodes = withAuthConnection host port creds $ do                 g <- B.runBatch $ do                         _ <- B.createNode someProperties                         B.createNode anotherProperties@@ -916,7 +933,7 @@  -- | Test batch, create and delete case_batchCreateDeleteNode :: Assertion-case_batchCreateDeleteNode = withConnection host port $ do+case_batchCreateDeleteNode = withAuthConnection host port creds $ do                 g <- B.runBatch $ do                         n <- B.createNode someProperties                         B.deleteNode n@@ -924,7 +941,7 @@  -- | Test batch, create two nodes and two relationships between them case_batchCreateRelationships :: Assertion-case_batchCreateRelationships = withConnection host port $ do+case_batchCreateRelationships = withAuthConnection host port creds $ do                 g <- B.runBatch $ do                     n1 <- B.createNode someProperties                     n2 <- B.createNode anotherProperties@@ -946,7 +963,7 @@  -- | Test batch, create and delete a relationship case_batchCreateDelRelationships :: Assertion-case_batchCreateDelRelationships = withConnection host port $ do+case_batchCreateDelRelationships = withAuthConnection host port creds $ do                 g <- B.runBatch $ do                     n1 <- B.createNode someProperties                     n2 <- B.createNode anotherProperties@@ -959,7 +976,7 @@  -- | Test batch getRelationshipFrom case_batchRelationshipNodeFrom :: Assertion-case_batchRelationshipNodeFrom = withConnection host port $ do+case_batchRelationshipNodeFrom = withAuthConnection host port creds $ do                 g <- B.runBatch $ do                     n1 <- B.createNode someProperties                     n2 <- B.createNode anotherProperties@@ -975,7 +992,7 @@  -- | Test batch getRelationshipTo case_batchRelationshipNodeTo :: Assertion-case_batchRelationshipNodeTo = withConnection host port $ do+case_batchRelationshipNodeTo = withAuthConnection host port creds $ do                 g <- B.runBatch $ do                     n1 <- B.createNode someProperties                     n2 <- B.createNode anotherProperties@@ -991,7 +1008,7 @@  -- | Test batch, get all relationships with filter case_batchGetRelationships :: Assertion-case_batchGetRelationships = withConnection host port $ do+case_batchGetRelationships = withAuthConnection host port creds $ do                 g <- B.runBatch $ do                     n1 <- B.createNode someProperties                     n2 <- B.createNode anotherProperties@@ -1010,7 +1027,7 @@  -- | Test batch, set properties case_batchSetProperties :: Assertion-case_batchSetProperties = withConnection host port $ do+case_batchSetProperties = withAuthConnection host port creds $ do                 let newProperties = M.fromList ["croqueta" |: ("2" :: T.Text)]                 g <- B.runBatch $ do                     n1 <- B.createNode someProperties@@ -1030,7 +1047,7 @@  -- | Test batch, set property case_batchSetProperty :: Assertion-case_batchSetProperty = withConnection host port $ do+case_batchSetProperty = withAuthConnection host port creds $ do                 let key = "hola"                 let val = newval False                 let newSomeProperties = M.insert key val someProperties@@ -1052,7 +1069,7 @@  -- | Test batch, delete properties case_batchDeleteProperties :: Assertion-case_batchDeleteProperties = withConnection host port $ do+case_batchDeleteProperties = withAuthConnection host port creds $ do                 g <- B.runBatch $ do                     n1 <- B.createNode someProperties                     n2 <- B.createNode anotherProperties@@ -1070,7 +1087,7 @@  -- | Test batch, delete property case_batchDeleteProperty :: Assertion-case_batchDeleteProperty= withConnection host port $ do+case_batchDeleteProperty= withAuthConnection host port creds $ do                 let key = "mytext"                 let newSomeProperties = M.delete key someProperties                 g <- B.runBatch $ do@@ -1091,18 +1108,18 @@ -- | Test batch, delete an unknown property, it should raise an exception case_batchDeleteUnknownProperty :: Assertion case_batchDeleteUnknownProperty= do-        n <- withConnection host port $ createNode someProperties+        n <- withAuthConnection host port creds $ createNode someProperties         let excMsg = "Node[" <> TE.decodeUtf8 (nodeId n) <>"] does not have a property \"" <> prop <> "\""         let expException = Neo4jNoSuchProperty excMsg-        assertException expException $ withConnection host port $ do+        assertException expException $ withAuthConnection host port creds $ do                     g <- B.runBatch $ B.deleteProperty n prop                     neo4jEqual G.empty g -- Doing this to force evaluation-        withConnection host port $ deleteNode n+        withAuthConnection host port creds $ deleteNode n     where prop = "noprop" :: T.Text  -- | Test batch, set add labels case_batchAddLabels :: Assertion-case_batchAddLabels = withConnection host port $ do+case_batchAddLabels = withAuthConnection host port creds $ do                 let label1 = "label1"                 let label2 = "label2"                 let label3 = "label3"@@ -1120,7 +1137,7 @@  -- | Test batch, change labels case_batchChangeLabels :: Assertion-case_batchChangeLabels = withConnection host port $ do+case_batchChangeLabels = withAuthConnection host port creds $ do                 let label1 = "label1"                 let label2 = "label2"                 let label3 = "label3"@@ -1135,7 +1152,7 @@  -- | Test batch, remove label case_batchRemoveLabel :: Assertion-case_batchRemoveLabel = withConnection host port $ do+case_batchRemoveLabel = withAuthConnection host port creds $ do                 let label1 = "label1"                 let label2 = "label2"                 let label3 = "label3"@@ -1150,7 +1167,7 @@  -- | Test batch, get all nodes with a label case_batchAllNodesWithLabel :: Assertion-case_batchAllNodesWithLabel = withConnection host port $ do+case_batchAllNodesWithLabel = withAuthConnection host port creds $ do         gp <- B.runBatch $ do             n1 <- B.createNode someProperties             n2 <- B.createNode someProperties@@ -1170,7 +1187,7 @@  -- | Test batch, get all nodes with a label and a property case_batchAllNodesWithLabelAndProperty :: Assertion-case_batchAllNodesWithLabelAndProperty = withConnection host port $ do+case_batchAllNodesWithLabelAndProperty = withAuthConnection host port creds $ do         gp <- B.runBatch $ do             n1 <- B.createNode someProperties             n2 <- B.createNode someProperties@@ -1190,7 +1207,7 @@  -- | Test cypher basic test case_cypherBasic :: Assertion-case_cypherBasic = withConnection host port $ do+case_cypherBasic = withAuthConnection host port creds $ do         -- create initial data         gp <- B.runBatch $ do             n1 <- B.createNode $ M.fromList ["name" |: ("I" :: T.Text)]@@ -1211,7 +1228,7 @@  -- | Test cypher create a node case_cypherCreateNode :: Assertion-case_cypherCreateNode = withConnection host port $ do+case_cypherCreateNode = withAuthConnection host port creds $ do         res <- C.cypher query params         neo4jBool $ C.isSuccess res         let gp = G.addCypher (C.fromSuccess res) G.empty@@ -1226,7 +1243,7 @@  -- | Test cypher create a node with multiple properties case_cypherCreateNodeMultipleProperties :: Assertion-case_cypherCreateNodeMultipleProperties = withConnection host port $ do+case_cypherCreateNodeMultipleProperties = withAuthConnection host port creds $ do         res <- C.cypher query params         neo4jBool $ C.isSuccess res         let gp = G.addCypher (C.fromSuccess res) G.empty@@ -1242,7 +1259,7 @@  -- | Test cypher create multiple nodes case_cypherCreateMultipleNodes :: Assertion-case_cypherCreateMultipleNodes = withConnection host port $ do+case_cypherCreateMultipleNodes = withAuthConnection host port creds $ do         res <- C.cypher query params         neo4jBool $ C.isSuccess res         let gp = G.addCypher (C.fromSuccess res) G.empty@@ -1259,7 +1276,7 @@  -- | Test cypher set all properties on a node case_cypherSetAllNodeProperties :: Assertion-case_cypherSetAllNodeProperties = withConnection host port $ do+case_cypherSetAllNodeProperties = withAuthConnection host port creds $ do         res <- C.cypher query params         neo4jBool $ C.isSuccess res         let gp = G.addCypher (C.fromSuccess res) G.empty@@ -1275,7 +1292,7 @@  -- | Test cypher basic query case_cypherBasicQuery :: Assertion-case_cypherBasicQuery = withConnection host port $ do+case_cypherBasicQuery = withAuthConnection host port creds $ do         -- create initial data         gp <- B.runBatch $ do             n1 <- B.createNode $ M.fromList ["name" |: ("I" :: T.Text)]@@ -1298,7 +1315,7 @@  -- | Test cypher basic query get relationships case_cypherBasicQueryGetRels :: Assertion-case_cypherBasicQueryGetRels = withConnection host port $ do+case_cypherBasicQueryGetRels = withAuthConnection host port creds $ do         -- create initial data         gp <- B.runBatch $ do             n1 <- B.createNode $ M.fromList ["name" |: ("I" :: T.Text)]@@ -1322,7 +1339,7 @@  -- | Test cypher nested results case_cypherNestedResults :: Assertion-case_cypherNestedResults = withConnection host port $ do+case_cypherNestedResults = withAuthConnection host port creds $ do         -- create initial data         gp <- B.runBatch $ do             n1 <- B.createNode $ M.fromList ["name" |: ("I" :: T.Text)]@@ -1346,7 +1363,7 @@  -- | Test cypher errors case_cypherError :: Assertion-case_cypherError = withConnection host port $ do+case_cypherError = withAuthConnection host port creds $ do         -- create initial data         gp <- B.runBatch $ do             B.createNode $ M.fromList ["age" |: (26 :: Int64)]@@ -1361,7 +1378,7 @@  -- | Test lone transaction cypher basic query case_loneTransactionBasicQuery :: Assertion-case_loneTransactionBasicQuery = withConnection host port $ do+case_loneTransactionBasicQuery = withAuthConnection host port creds $ do         -- create initial data         gp <- B.runBatch $ do             n1 <- B.createNode $ M.fromList ["name" |: ("I" :: T.Text)]@@ -1385,7 +1402,7 @@  -- | Test cypher errors in a transaction case_cypherTransactionError :: Assertion-case_cypherTransactionError = withConnection host port $ do+case_cypherTransactionError = withAuthConnection host port creds $ do         -- create initial data         gp <- B.runBatch $ B.createNode $ M.fromList ["age" |: (26 :: Int64)]         -- actual test@@ -1399,7 +1416,7 @@  -- | Test a cypher transaction case_cypherTransaction :: Assertion-case_cypherTransaction = withConnection host port $ do+case_cypherTransaction = withAuthConnection host port creds $ do         res <- TC.runTransaction $ do             result <- TC.cypher "CREATE (pere: PERSON {age: {age}}) CREATE (pau: PERSON {props}) \                               \CREATE p1 = (pere)-[:KNOWS]->(pau) RETURN pere, pau, p1, pere.age" $@@ -1424,7 +1441,7 @@  -- | Test a cypher transaction with a explicit commit case_cypherTransactionExplicitCommit :: Assertion-case_cypherTransactionExplicitCommit = withConnection host port $ do+case_cypherTransactionExplicitCommit = withAuthConnection host port creds $ do         res <- TC.runTransaction $ do             result <- TC.cypher "CREATE (pere: PERSON {age: {age}}) CREATE (pau: PERSON {props}) \                               \CREATE p1 = (pere)-[:KNOWS]->(pau) RETURN pere, pau, p1, pere.age" $@@ -1451,7 +1468,7 @@  -- | Test a cypher transaction with a keepalive case_cypherTransactionKeepAlive :: Assertion-case_cypherTransactionKeepAlive = withConnection host port $ do+case_cypherTransactionKeepAlive = withAuthConnection host port creds $ do         res <- TC.runTransaction $ do             TC.keepalive             void $ TC.cypher "CREATE (pep: PERSON {age: 55})" M.empty@@ -1479,7 +1496,7 @@  -- | Test a cypher transaction with an error case_cypherErrorInTransaction :: Assertion-case_cypherErrorInTransaction = withConnection host port $ do+case_cypherErrorInTransaction = withAuthConnection host port creds $ do         res <- TC.runTransaction $ do             -- query with wrong syntax             void $ TC.cypher "i" M.empty@@ -1494,7 +1511,7 @@  -- | Test a cypher rollback transaction case_cypherTransactionRollback :: Assertion-case_cypherTransactionRollback = withConnection host port $ do+case_cypherTransactionRollback = withAuthConnection host port creds $ do          void $ TC.runTransaction $ do             void $ TC.cypher "CREATE (pepe: PERSON {age: 55})" M.empty             result <- TC.cypher "CREATE (pere: PERSON {age: {age}}) CREATE (pau: PERSON {props}) \@@ -1506,7 +1523,7 @@  -- | Test a cypher rollback and leave transaction case_cypherTransactionRollbackAndLeave :: Assertion-case_cypherTransactionRollbackAndLeave = withConnection host port $ do+case_cypherTransactionRollbackAndLeave = withAuthConnection host port creds $ do          res <- TC.runTransaction $ do             void $ TC.cypher "CREATE (pepe: PERSON {age: 55})" M.empty             result <- TC.cypher "CREATE (pere: PERSON {age: {age}}) CREATE (pau: PERSON {props}) \@@ -1521,7 +1538,7 @@  -- | Test issuing a commits after a rollback case_cypherTransactionEnded :: Assertion-case_cypherTransactionEnded = assertException expException $ withConnection host port $ do+case_cypherTransactionEnded = assertException expException $ withAuthConnection host port creds $ do      void $ TC.runTransaction $ do             void $ TC.cypher "CREATE (pepe: PERSON {age: 55})" M.empty             result <- TC.cypher "CREATE (pere: PERSON {age: {age}}) CREATE (pau: PERSON {props}) \@@ -1535,7 +1552,7 @@  -- | Test graph union op case_graphUnion :: Assertion-case_graphUnion = withConnection host port $ do+case_graphUnion = withAuthConnection host port creds $ do                 g <- B.runBatch $ do                     n1 <- B.createNode someProperties                     n2 <- B.createNode anotherProperties@@ -1564,7 +1581,7 @@  -- | Test graph difference op case_graphDifference :: Assertion-case_graphDifference = withConnection host port $ do+case_graphDifference = withAuthConnection host port creds $ do                 g <- B.runBatch $ do                     n1 <- B.createNode someProperties                     n2 <- B.createNode anotherProperties@@ -1581,7 +1598,7 @@  -- | Test graph intersection op case_graphIntersection :: Assertion-case_graphIntersection = withConnection host port $ do+case_graphIntersection = withAuthConnection host port creds $ do                 g <- B.runBatch $ do                     n1 <- B.createNode someProperties                     n2 <- B.createNode anotherProperties@@ -1629,19 +1646,19 @@ -- | Test a traversal with an unexisting start case_traversalNotFound :: Assertion case_traversalNotFound = do-        g <- withConnection host port $ setUpTraversalTest+        g <- withAuthConnection host port creds $ setUpTraversalTest         let start = fromJust $ G.getNamedNode "Root" g         let expException = Neo4jNoEntityException $ (TE.encodeUtf8 . runNodePath . nodePath) start-        assertException expException $ withConnection host port $ do+        assertException expException $ withAuthConnection host port creds $ do             let rels = map (\n -> fromJust $ G.getNamedRelationship n g) ["Root-Johan", "Root-Mattias"]             mapM_ deleteRelationship rels             deleteNode start             void $ T.traverseGetNodes def start-        withConnection host port $ cleanUpTraversalTest g+        withAuthConnection host port creds $ cleanUpTraversalTest g  -- | Test a default traversal returning nodes case_defaultTraversalNodes :: Assertion-case_defaultTraversalNodes = withConnection host port $ do+case_defaultTraversalNodes = withAuthConnection host port creds $ do     g <- setUpTraversalTest     let start = fromJust $ G.getNamedNode "Root" g     ns <- T.traverseGetNodes def start@@ -1651,7 +1668,7 @@  -- | Test a default traversal returning relationships case_defaultTraversalRels :: Assertion-case_defaultTraversalRels = withConnection host port $ do+case_defaultTraversalRels = withAuthConnection host port creds $ do     g <- setUpTraversalTest     let start = fromJust $ G.getNamedNode "Root" g     rs <- T.traverseGetRels def start@@ -1661,7 +1678,7 @@  -- | Test a default traversal returning id paths case_defaultTraversalIdPath :: Assertion-case_defaultTraversalIdPath = withConnection host port $ do+case_defaultTraversalIdPath = withAuthConnection host port creds $ do     g <- setUpTraversalTest     let start = fromJust $ G.getNamedNode "Root" g     ps <- L.sort <$> T.traverseGetPath def start@@ -1681,7 +1698,7 @@  -- | Test a default traversal returning full paths case_defaultTraversalFullPath :: Assertion-case_defaultTraversalFullPath = withConnection host port $ do+case_defaultTraversalFullPath = withAuthConnection host port creds $ do     g <- setUpTraversalTest     let start = fromJust $ G.getNamedNode "Root" g     ps <- L.sort <$> T.traverseGetFullPath def start@@ -1706,19 +1723,19 @@ -- | Test a traversal with an unexisting start case_pagedTraversalNotFound :: Assertion case_pagedTraversalNotFound = do-        g <- withConnection host port $ setUpTraversalTest+        g <- withAuthConnection host port creds $ setUpTraversalTest         let start = fromJust $ G.getNamedNode "Root" g         let expException = Neo4jNoEntityException $ (TE.encodeUtf8 . runNodePath . nodePath) start-        assertException expException $ withConnection host port $ do+        assertException expException $ withAuthConnection host port creds $ do             let rels = map (\n -> fromJust $ G.getNamedRelationship n g) ["Root-Johan", "Root-Mattias"]             mapM_ deleteRelationship rels             deleteNode start             void $ T.pagedTraverseGetNodes def def start-        withConnection host port $ cleanUpTraversalTest g+        withAuthConnection host port creds $ cleanUpTraversalTest g  -- | Test a paged traversal returning nodes case_pagedTraversalNodes :: Assertion-case_pagedTraversalNodes = withConnection host port $ do+case_pagedTraversalNodes = withAuthConnection host port creds $ do     g <- setUpTraversalTest     let start = fromJust $ G.getNamedNode "Root" g     let desc = def {T.travDepth = Left 2}@@ -1743,7 +1760,7 @@  -- | Test a paged traversal returning relationships case_pagedTraversalRels :: Assertion-case_pagedTraversalRels = withConnection host port $ do+case_pagedTraversalRels = withAuthConnection host port creds $ do     g <- setUpTraversalTest     let start = fromJust $ G.getNamedNode "Root" g     let desc = def@@ -1763,7 +1780,7 @@  -- | Test a paged traversal returning id paths  case_pagedTraversalIdPaths :: Assertion-case_pagedTraversalIdPaths = withConnection host port $ do+case_pagedTraversalIdPaths = withAuthConnection host port creds $ do     g <- setUpTraversalTest     let start = fromJust $ G.getNamedNode "Root" g     let desc = def@@ -1791,7 +1808,7 @@  -- | Test a paged traversal returning full paths  case_pagedTraversalFullPaths :: Assertion-case_pagedTraversalFullPaths = withConnection host port $ do+case_pagedTraversalFullPaths = withAuthConnection host port creds $ do     g <- setUpTraversalTest     let start = fromJust $ G.getNamedNode "Root" g     let desc = def@@ -1817,7 +1834,7 @@  -- | Test traversal depth first search case_dfsTraversalNodes :: Assertion-case_dfsTraversalNodes = withConnection host port $ do+case_dfsTraversalNodes = withAuthConnection host port creds $ do     g <- setUpTraversalTest     let start = fromJust $ G.getNamedNode "Root" g     let desc = def {T.travDepth = Left 2, T.travOrder = T.DepthFirst}@@ -1828,7 +1845,7 @@  -- | Test traversal with a relation filter case_relFilterTraversalNodes :: Assertion-case_relFilterTraversalNodes = withConnection host port $ do+case_relFilterTraversalNodes = withAuthConnection host port creds $ do     g <- setUpTraversalTest     let start = fromJust $ G.getNamedNode "Tobias" g     let desc = def {T.travRelFilter = [("loves", Outgoing)]}@@ -1855,7 +1872,7 @@  -- | Test traversal with a uniqueness constraint case_uniquenessTraversalNodes :: Assertion-case_uniquenessTraversalNodes = withConnection host port $ do+case_uniquenessTraversalNodes = withAuthConnection host port creds $ do     g <- setUpTraversalTest     let start = fromJust $ G.getNamedNode "Tobias" g     let desc = def {T.travDepth = Left 2, T.travRelFilter = [("loves", Any), ("hates", Any), ("admires", Any)]}@@ -1882,7 +1899,7 @@  -- | Test traversal with a javascript depth expression case_progDepthTraversalNodes :: Assertion-case_progDepthTraversalNodes = withConnection host port $ do+case_progDepthTraversalNodes = withAuthConnection host port creds $ do     g <- setUpTraversalTest     let start = fromJust $ G.getNamedNode "Root" g     let desc = def {T.travDepth = Right "position.length() >= 2;"}@@ -1894,17 +1911,17 @@ -- | Test traversal with a wrong javascript depth expression case_wrongProgDepthTraversalNodes :: Assertion case_wrongProgDepthTraversalNodes = do-        g <- withConnection host port $ setUpTraversalTest-        assertException expException $ withConnection host port $ do+        g <- withAuthConnection host port creds $ setUpTraversalTest+        assertException expException $ withAuthConnection host port creds $ do             let start = fromJust $ G.getNamedNode "Root" g             let desc = def {T.travDepth = Right "positionlength() >= 2;"}             void $ T.traverseGetNodes desc start-        withConnection host port $ cleanUpTraversalTest g+        withAuthConnection host port creds $ cleanUpTraversalTest g       where expException = Neo4jUnexpectedResponseException HT.status400  -- | Test traversal without initial node case_returnButFirstTraversal :: Assertion-case_returnButFirstTraversal = withConnection host port $ do+case_returnButFirstTraversal = withAuthConnection host port creds $ do     g <- setUpTraversalTest     let start = fromJust $ G.getNamedNode "Root" g     let desc = def {T.travNodeFilter = Left T.ReturnAllButStartNode}@@ -1915,7 +1932,7 @@  -- | Test filter nodes without initial node case_filterNodesTraversal :: Assertion-case_filterNodesTraversal = withConnection host port $ do+case_filterNodesTraversal = withAuthConnection host port creds $ do     g <- setUpTraversalTest     let start = fromJust $ G.getNamedNode "Root" g     let desc = def {T.travNodeFilter = Right "position.endNode().getProperty('name').toLowerCase().contains('t');"}@@ -1927,10 +1944,10 @@ -- | Test traversal with a filter expression case_wrongFilterNodesTraversal :: Assertion case_wrongFilterNodesTraversal = do-        g <- withConnection host port $ setUpTraversalTest-        assertException expException $ withConnection host port $ do+        g <- withAuthConnection host port creds $ setUpTraversalTest+        assertException expException $ withAuthConnection host port creds $ do             let start = fromJust $ G.getNamedNode "Root" g             let desc = def {T.travNodeFilter = Right "posiiiitionlength() >= 2;"}             void $ T.traverseGetNodes desc start-        withConnection host port $ cleanUpTraversalTest g+        withAuthConnection host port creds $ cleanUpTraversalTest g       where expException = Neo4jUnexpectedResponseException HT.status400