asilvestre / haskell-neo4j-rest-client

Haskell neo4j REST client
MIT License
25 stars 7 forks source link

Add support for HTTP basic authentication #18

Closed eriknstevenson closed 9 years ago

eriknstevenson commented 9 years ago

Fixes #17

eriknstevenson commented 9 years ago

I wasn't sure the best way to go about writing testing as I don't have much experience with it. Maybe you could take a look at how I've done it and suggest an improvement? Currently half the tests fail based on if the Neo4j database has auth enabled or not.

Also the .travis.yml needs some adjustment. Looking at it now.

Edit: So I updated the tests you had written to use authentication, and added a new test to test the use of improper/no credentials. Neo4j uses a default username/password of neo4j/neo4j, however access is denied without first changing the password to something else (From the documentation - "However, the default password must be changed (see the section called “User status and password changing”) before access to resources will be permitted. This can easily be done via the Neo4j Browser, or via direct HTTP calls.").

Currently playing around with travis-ci (having never used it before) and trying to find a way to change the password. Not having much luck at the moment with my first attempted solution, which was to use something called httpie.

eriknstevenson commented 9 years ago

Seems to be working now with the exception of the very first test which I believe was failing before this pull request (at least on my machine). It is an issue with the expected exception.

eriknstevenson commented 9 years ago

The tests that run with the later version of Neo4j (2.2.1, which supports authentication) are passing, however the tests run with previous versions fail. This is because previous versions of Neo4j don't support authentication and the tests now assume a version of Neo4j > 2.2.0. Despite this, code using this library and running with databases written for Neo4j versions previous to 2.2.0 will still work correctly.

That being said, I recommend removing Neo4j versions < 2.2.0 from the travis-ci builds, but I leave that decision up to you.

eriknstevenson commented 9 years ago

Closing this PR for now, will reopen upon addition of feature that allows program to get version of Neo4j that is running. This will allow tests to pass on versions < 2.2.0.