@@ -31,7 +31,7 @@ var PassThroughDuplex = require('../../lib/passthroughduplex.js');
3131// These globals may potentially be parameterized.
3232var ME = process . env . cloudant_username || 'nodejs' ;
3333var PASSWORD = process . env . cloudant_password || 'sjedon' ;
34- var SERVER = 'https://' + ME + '.cloudant.com' ;
34+ var SERVER = process . env . SERVER_URL || 'https://' + ME + '.cloudant.com' ;
3535var dbName ;
3636var mydb = null ;
3737var cc = null ;
@@ -47,7 +47,7 @@ var onBefore = function(done) {
4747 . put ( '/' + dbName ) . reply ( 200 , { 'ok' : true } )
4848 . put ( '/' + dbName + '/mydoc' ) . reply ( 200 , { id : 'mydoc' , rev : '1-1' } ) ;
4949
50- cc = Cloudant ( { account : ME , password : PASSWORD , plugins : 'retry' } ) ;
50+ cc = Cloudant ( { url : SERVER , username : ME , password : PASSWORD , plugins : 'retry' } ) ;
5151 cc . db . create ( dbName , function ( er , d ) {
5252 should ( er ) . equal ( null ) ;
5353 d . should . be . an . Object ;
@@ -93,7 +93,7 @@ describe('retry-on-429 plugin', function() {
9393 if ( typeof ( process . env . NOCK_OFF ) === 'undefined' ) {
9494 mocks . persist ( ) . get ( '/' + dbName ) . reply ( 200 , { } ) ;
9595 }
96- var cloudant = Cloudant ( { plugins : 'retry' , account : ME , password : PASSWORD } ) ;
96+ var cloudant = Cloudant ( { plugins : 'retry' , url : SERVER , username : ME , password : PASSWORD } ) ;
9797 cloudant . cc . _addPlugins ( 'retry' ) ; // retry socket hang up errors
9898 var db = cloudant . db . use ( dbName ) ;
9999 this . timeout ( 10000 ) ;
@@ -106,7 +106,7 @@ describe('retry-on-429 plugin', function() {
106106
107107 it ( 'allow no callback' , function ( done ) {
108108 var mocks = nock ( SERVER ) . get ( '/' + dbName ) . reply ( 200 , { } ) ;
109- var cloudant = Cloudant ( { plugins : 'retry' , account : ME , password : PASSWORD } ) ;
109+ var cloudant = Cloudant ( { plugins : 'retry' , url : SERVER , username : ME , password : PASSWORD } ) ;
110110 var db = cloudant . db . use ( dbName ) ;
111111 this . timeout ( 10000 ) ;
112112 db . info ( ) ;
@@ -116,7 +116,7 @@ describe('retry-on-429 plugin', function() {
116116 it ( 'should return a stream' , function ( done ) {
117117 var mocks = nock ( SERVER )
118118 . get ( '/' + dbName ) . reply ( 200 , { ok : true } ) ;
119- var cloudant = Cloudant ( { plugins : 'retry' , account : ME , password : PASSWORD } ) ;
119+ var cloudant = Cloudant ( { plugins : 'retry' , url : SERVER , username : ME , password : PASSWORD } ) ;
120120 var db = cloudant . db . use ( dbName ) ;
121121 var p = db . info ( function ( ) {
122122 done ( ) ;
@@ -132,7 +132,7 @@ describe('promise plugin', function() {
132132 it ( 'should return a promise' , function ( done ) {
133133 var mocks = nock ( SERVER )
134134 . get ( '/' + dbName ) . reply ( 200 , { ok : true } ) ;
135- var cloudant = Cloudant ( { plugins : 'promises' , account : ME , password : PASSWORD } ) ;
135+ var cloudant = Cloudant ( { plugins : 'promises' , url : SERVER , username : ME , password : PASSWORD } ) ;
136136 var db = cloudant . db . use ( dbName ) ;
137137 var p = db . info ( ) . then ( function ( data ) {
138138 data . should . be . an . Object ;
@@ -144,7 +144,7 @@ describe('promise plugin', function() {
144144 it ( 'should return an error status code' , function ( done ) {
145145 var mocks = nock ( SERVER )
146146 . get ( '/somedbthatdoesntexist' ) . reply ( 404 , { ok : false } ) ;
147- var cloudant = Cloudant ( { plugins : 'promises' , account : ME , password : PASSWORD } ) ;
147+ var cloudant = Cloudant ( { plugins : 'promises' , url : SERVER , username : ME , password : PASSWORD } ) ;
148148 var db = cloudant . db . use ( 'somedbthatdoesntexist' ) ;
149149 var p = db . info ( ) . then ( function ( data ) {
150150 assert ( false ) ;
@@ -167,7 +167,7 @@ describe('cookieauth plugin', function() {
167167 var mocks = nock ( SERVER )
168168 . post ( '/_session' ) . reply ( 200 , { ok : true } )
169169 . get ( '/' + dbName ) . reply ( 200 , { ok : true } ) ;
170- var cloudant = Cloudant ( { plugins : 'cookieauth' , account : ME , password : PASSWORD } ) ;
170+ var cloudant = Cloudant ( { plugins : 'cookieauth' , url : SERVER , username : ME , password : PASSWORD } ) ;
171171 var db = cloudant . db . use ( dbName ) ;
172172 var p = db . info ( function ( err , data ) {
173173 assert . equal ( err , null ) ;
@@ -183,7 +183,7 @@ describe('cookieauth plugin', function() {
183183 var mocks = nock ( SERVER )
184184 . post ( '/_session' , { name : ME , password : PASSWORD } ) . reply ( 200 , { ok : true , info : { } , userCtx : { name : ME , roles : [ '_admin' ] } } )
185185 . get ( '/' + dbName + '/mydoc' ) . reply ( 200 , { _id : 'mydoc' , _rev : '1-123' , ok : true } ) ;
186- var cloudant = Cloudant ( { plugins : 'cookieauth' , account : ME , password : PASSWORD } ) ;
186+ var cloudant = Cloudant ( { plugins : 'cookieauth' , url : SERVER , username : ME , password : PASSWORD } ) ;
187187 var db = cloudant . db . use ( dbName ) ;
188188 var p = db . get ( 'mydoc' , function ( err , data ) {
189189 assert . equal ( err , null ) ;
@@ -204,7 +204,7 @@ describe('cookieauth plugin', function() {
204204 . reply ( 401 , { error : 'unauthorized' , reason : 'Name or password is incorrect.' } )
205205 . get ( '/' + dbName + '/mydoc' )
206206 . reply ( 401 , { error : 'unauthorized' , reason : 'Name or password is incorrect.' } ) ;
207- var cloudant = Cloudant ( { plugins : 'cookieauth' , account : ME , password : 'wrongpassword' } ) ;
207+ var cloudant = Cloudant ( { plugins : 'cookieauth' , url : SERVER , username : ME , password : 'wrongpassword' } ) ;
208208 var db = cloudant . db . use ( dbName ) ;
209209 var p = db . get ( 'mydoc' , function ( err , data ) {
210210 assert . equal ( data , null ) ;
@@ -223,7 +223,7 @@ describe('cookieauth plugin', function() {
223223 . post ( '/_session' , { name : ME , password : PASSWORD } ) . reply ( 200 , { ok : true , info : { } , userCtx : { name : ME , roles : [ '_admin' ] } } , { 'Set-Cookie' : 'AuthSession=xyz; Version=1; Path=/; HttpOnly' } )
224224 . get ( '/' + dbName + '/mydoc' ) . reply ( 200 , { _id : 'mydoc' , _rev : '1-123' , ok : true } )
225225 . get ( '/' + dbName + '/mydoc' ) . reply ( 200 , { _id : 'mydoc' , _rev : '1-123' , ok : true } ) ;
226- var cloudant = Cloudant ( { plugins : 'cookieauth' , account : ME , password : PASSWORD } ) ;
226+ var cloudant = Cloudant ( { plugins : 'cookieauth' , url : SERVER , username : ME , password : PASSWORD } ) ;
227227 var db = cloudant . db . use ( dbName ) ;
228228 var p = db . get ( 'mydoc' , function ( err , data ) {
229229 assert . equal ( err , null ) ;
@@ -272,7 +272,7 @@ describe('cookieauth plugin', function() {
272272 . reply ( 401 , { error : 'unauthorized' , reason : 'Name or password is incorrect.' } )
273273 . get ( '/' )
274274 . reply ( 200 , { couchdb : 'Welcome' , version : '1.0.2' , cloudant_build : '2488' } ) ;
275- var cloudant = Cloudant ( { plugins : 'cookieauth' , account : ME , password : PASSWORD } , function ( err , cloudant , data ) {
275+ var cloudant = Cloudant ( { plugins : 'cookieauth' , url : SERVER , username : ME , password : PASSWORD } , function ( err , cloudant , data ) {
276276 cloudant . should . be . an . Object ;
277277 data . should . be . an . Object . have . a . property ( 'couchdb' ) ;
278278 mocks . done ( ) ;
@@ -309,7 +309,7 @@ describe('custom plugin', function() {
309309 . get ( '/' )
310310 . reply ( 200 , { couchdb : 'Welcome' , version : '1.0.2' , cloudant_build : '2488' } ) ;
311311
312- var cloudant = Cloudant ( { plugins : defaultPlugin , account : ME , password : PASSWORD } ) ;
312+ var cloudant = Cloudant ( { plugins : defaultPlugin , url : SERVER , username : ME , password : PASSWORD } ) ;
313313 cloudant . ping ( function ( err , data ) {
314314 assert . equal ( err , null ) ;
315315 assert . equal ( data . couchdb , 'Welcome' ) ;
@@ -339,7 +339,7 @@ describe('custom plugin', function() {
339339 . get ( '/' )
340340 . reply ( 200 , { couchdb : 'Welcome' } ) ;
341341
342- Cloudant ( { plugins : defaultPlugin , account : ME , password : PASSWORD } , function ( err , nano , pong ) {
342+ Cloudant ( { plugins : defaultPlugin , url : SERVER , username : ME , password : PASSWORD } , function ( err , nano , pong ) {
343343 assert . equal ( err , null ) ;
344344 assert . notEqual ( nano , null ) ;
345345 assert . equal ( pong . couchdb , 'Welcome' ) ;
@@ -357,7 +357,7 @@ describe('custom plugin', function() {
357357 . get ( '/' )
358358 . reply ( 401 , { error : 'unauthorized' , reason : 'Name or password is incorrect.' } ) ;
359359
360- Cloudant ( { plugins : defaultPlugin , account : ME , password : badPass } , function ( err , nano ) {
360+ Cloudant ( { plugins : defaultPlugin , url : SERVER , username : ME , password : badPass } , function ( err , nano ) {
361361 assert . equal ( err . error , 'unauthorized' ) ;
362362 assert . equal ( nano , null ) ;
363363 mocks . done ( ) ;
0 commit comments