elliotf / mocha-mongoose

test helpers for using mongodb with mocha
MIT License
107 stars 21 forks source link

Mongoose connection to DB running with auth=true #1

Closed AussieFlem closed 11 years ago

AussieFlem commented 12 years ago

I'm just looking at the example code, and it works fine, but only if I've got the server running without auth=true.

Is it possible to test against a server running with authentication on?

I tried setting the URL to mongodb://theUsername:thePassword@localhost/demo-app-clearing-db'

but Mocha threw errors:

Error: done() invoked with non-Error: unauthorized db:demo-app-clearing-db ns:demo-app-clearing-db.system.namespaces lock type:1 client:127.0.0.1

Am I doing something stupid or does it only work without the DB needing authentication?

Cheers :)

elliotf commented 12 years ago

You are definitely not doing anything stupid. I'll work on making it support authenticated connections.

AussieFlem commented 12 years ago

Great - otherwise it's working well for me (I think!)

elliotf commented 12 years ago

@AussieFlem sorry, but I'm not finding the time to support auth at the moment. If you find the time, I would be more than happy to accept a pull request; just make sure it's tested.

elliotf commented 11 years ago

Note to self: root cause is how the DB connection is being made. Should call mongodb.MongoClient.connect(uriString, cb) rather than instantiating a Db myself. That gets users to work.

This should be fixed later this week.

elliotf commented 11 years ago

Documentation re: MongoClient: http://mongodb.github.com/node-mongodb-native/driver-articles/mongoclient.html

elliotf commented 11 years ago

Fixed in 0.1.2