diff --git a/test-app/.dpd/deployments.json b/test-app/.dpd/deployments.json new file mode 100644 index 0000000..31f4424 --- /dev/null +++ b/test-app/.dpd/deployments.json @@ -0,0 +1 @@ +{"test-app.deploydapp.com":{"subdomain":"abcdefg"},"foo":"bar","abcdefg.deploydapp.com":{"remote":"deploydapp.com","path":"/Users/skawful/Dropbox/node_modules/deployd/test-app","name":"abcdefg","subdomain":"abcdefg","user":"ritch"},"ritch.deploydapp.com":{"remote":"deploydapp.com","path":"/Users/skawful/Dropbox/node_modules/deployd/test-app","name":"ritch","subdomain":"ritch","user":"test-app"}} \ No newline at end of file diff --git a/test/db-remote.config.json b/test/db-remote.config.json deleted file mode 100644 index f9e57c4..0000000 --- a/test/db-remote.config.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "warning": "This test is going to wipe your db, don't use a production machine", - "you've": "been warned...", - "host": "foo.com", - "port": 27017, - "name": "test-collection", - "credentials": { - "username": "foo", - "password": "secret" - } -} \ No newline at end of file diff --git a/test/db-remote.unit.js b/test/db-remote.unit.js index 6bab9a6..3632c95 100644 --- a/test/db-remote.unit.js +++ b/test/db-remote.unit.js @@ -1,17 +1,15 @@ var fs = require('fs') , db = require('../lib/db') - , configContents = fs.readFileSync('db-remote.config.json','utf8') - , config = JSON.parse(configContents) + , config = require(__dirname + '/support/db-remote.config.json') , tester = db.create(config) , store = tester.createStore('test-store') - , Store = require('../lib/db').Store , assert = require('assert') - ; - -if (config.host == 'foo.com') { - console.warn('Before you run db-remote.unit.js tests, set up the configuration in "db-remote.config.json".') - return; -} + , cp = require('child_process'); + +before(function (done) { + var cmd = "mongo " + config.name + " --eval 'db.system.users.remove({}); db.addUser(\"" + config.credentials.username + "\", \"" + config.credentials.password + "\");'"; + cp.exec(cmd, done); +}); beforeEach(function(done){ store.remove(function () { diff --git a/test/support/db-remote.config.json b/test/support/db-remote.config.json new file mode 100644 index 0000000..7b08061 --- /dev/null +++ b/test/support/db-remote.config.json @@ -0,0 +1,9 @@ +{ + "host": "127.0.0.1", + "port": 27017, + "name": "dpd-faux-remote", + "credentials": { + "username": "foo", + "password": "secret" + } +} \ No newline at end of file