@@ -28,7 +28,7 @@ var Cloudant = require('../../cloudant.js');
2828// These globals may potentially be parameterized.
2929var ME = process . env . cloudant_username || 'nodejs' ;
3030var PASSWORD = process . env . cloudant_password || 'sjedon' ;
31- var SERVER = 'https://' + ME + '.cloudant.com' ;
31+ var SERVER = process . env . SERVER_URL || 'https://' + ME + '.cloudant.com' ;
3232var mydb = null ;
3333var cc = null ;
3434var ddoc = null ;
@@ -43,7 +43,7 @@ describe('Cloudant API', function() {
4343 } ) ;
4444} ) ;
4545
46- describe ( 'Initialization' , function ( ) {
46+ describe ( '#db Initialization' , function ( ) {
4747 it ( 'runs synchronously with one argument' , function ( ) {
4848 ( function ( ) {
4949 var db = Cloudant ( { account : ME } ) ;
@@ -55,7 +55,7 @@ describe('Initialization', function() {
5555 . post ( '/_session' ) . reply ( 200 , { ok : true } )
5656 . get ( '/' ) . reply ( 200 , { couchdb : 'Welcome' , version : '1.0.2' } ) ;
5757
58- Cloudant ( { account : ME , username : ME , password : PASSWORD } , function ( er , cloudant , body ) {
58+ Cloudant ( { url : SERVER , username : ME , password : PASSWORD } , function ( er , cloudant , body ) {
5959 should ( er ) . equal ( null , 'No problem pinging Cloudant' ) ;
6060 cloudant . should . be . an . Object ;
6161 body . should . be . an . Object ;
@@ -89,7 +89,7 @@ describe('Initialization', function() {
8989 . post ( '/_session' ) . reply ( 200 , { ok : true , userCtx : { name : ME , roles : [ ] } } )
9090 . get ( '/' ) . reply ( 200 , { couchdb : 'Welcome' , version : '1.0.2' } ) ;
9191
92- Cloudant ( { account : ME , username : ME , password : PASSWORD } , function ( er , cloudant , welcome ) {
92+ Cloudant ( { url : SERVER , username : ME , password : PASSWORD } , function ( er , cloudant , welcome ) {
9393 should ( er ) . equal ( null , 'No problem pinging Cloudant' ) ;
9494 cloudant . should . be . an . Object ;
9595
@@ -110,12 +110,12 @@ describe('Initialization', function() {
110110 } ) ;
111111} ) ;
112112
113- describe ( 'Authentication' , function ( ) {
113+ describe ( '#db Authentication' , function ( ) {
114114 it ( 'supports Authentication API - POST /_api/v2/api_keys' , function ( done ) {
115115 var mocks = nock ( SERVER )
116116 . post ( '/_api/v2/api_keys' ) . reply ( 200 , { 'password' : 'Eivln4jPiLS8BoTxjXjVukDT' , 'ok' : true , 'key' : 'thandoodstrenterprourete' } ) ;
117117
118- var c = Cloudant ( { account : ME , password : PASSWORD , plugins : 'retry' } ) ;
118+ var c = Cloudant ( { url : SERVER , username : ME , password : PASSWORD , plugins : 'retry' } ) ;
119119 c . generate_api_key ( function ( er , d ) {
120120 should ( er ) . equal ( null ) ;
121121 d . should . be . an . Object ;
@@ -132,12 +132,12 @@ describe('Authentication', function() {
132132 } ) ;
133133} ) ;
134134
135- describe ( 'CORS' , function ( ) {
135+ describe ( '#db CORS' , function ( ) {
136136 it ( 'supports CORS API - GET /_api/v2/user/config/cors' , function ( done ) {
137137 var mocks = nock ( SERVER )
138138 . get ( '/_api/v2/user/config/cors' ) . reply ( 200 , { 'enable_cors' : true , 'allow_credentials' : true , 'origins' : [ '*' ] } ) ;
139139
140- var c = Cloudant ( { account : ME , password : PASSWORD , plugins : 'retry' } ) ;
140+ var c = Cloudant ( { url : SERVER , username : ME , password : PASSWORD , plugins : 'retry' } ) ;
141141 c . get_cors ( function ( er , d ) {
142142 should ( er ) . equal ( null ) ;
143143 d . should . be . an . Object ;
@@ -157,7 +157,7 @@ describe('CORS', function() {
157157 var mocks = nock ( SERVER )
158158 . put ( '/_api/v2/user/config/cors' ) . reply ( 200 , { 'ok' : true } ) ;
159159
160- var c = Cloudant ( { account : ME , password : PASSWORD , plugins : 'retry' } ) ;
160+ var c = Cloudant ( { url : SERVER , username : ME , password : PASSWORD , plugins : 'retry' } ) ;
161161 c . set_cors ( { 'enable_cors' : true , 'allow_credentials' : true , 'origins' : [ '*' ] } , function ( er , d ) {
162162 should ( er ) . equal ( null ) ;
163163 d . should . be . an . Object ;
@@ -170,7 +170,7 @@ describe('CORS', function() {
170170 } ) ;
171171} ) ;
172172
173- describe ( 'Authorization' , function ( ) {
173+ describe ( '#db Authorization' , function ( ) {
174174 var dbName ;
175175
176176 before ( function ( done ) {
@@ -179,7 +179,7 @@ describe('Authorization', function() {
179179 var mocks = nock ( SERVER )
180180 . put ( '/' + dbName ) . reply ( 200 , { 'ok' : true } ) ;
181181
182- cc = Cloudant ( { account : ME , password : PASSWORD , plugins : 'retry' } ) ;
182+ cc = Cloudant ( { url : SERVER , username : ME , password : PASSWORD , plugins : 'retry' } ) ;
183183 cc . db . create ( dbName , function ( er , d ) {
184184 should ( er ) . equal ( null ) ;
185185 d . should . be . an . Object ;
@@ -239,7 +239,7 @@ describe('Authorization', function() {
239239 } ) ;
240240} ) ;
241241
242- describe ( 'Cloudant-Specific APIs' , function ( ) {
242+ describe ( '#db Cloudant-Specific APIs' , function ( ) {
243243 var dbName ;
244244
245245 before ( function ( done ) {
@@ -248,7 +248,7 @@ describe('Cloudant-Specific APIs', function() {
248248 var mocks = nock ( SERVER )
249249 . put ( '/' + dbName ) . reply ( 200 , { 'ok' : true } ) ;
250250
251- cc = Cloudant ( { account : ME , password : PASSWORD , plugins : 'retry' } ) ;
251+ cc = Cloudant ( { url : SERVER , username : ME , password : PASSWORD , plugins : 'retry' } ) ;
252252 cc . db . create ( dbName , function ( er , d ) {
253253 should ( er ) . equal ( null ) ;
254254 d . should . be . an . Object ;
@@ -349,7 +349,7 @@ describe('Cloudant-Specific APIs', function() {
349349 } ) ;
350350} ) ;
351351
352- describe ( 'Changes query' , function ( ) {
352+ describe ( '#db Changes query' , function ( ) {
353353 var dbName ;
354354
355355 before ( function ( done ) {
@@ -358,7 +358,7 @@ describe('Changes query', function() {
358358 var mocks = nock ( SERVER )
359359 . put ( '/' + dbName ) . reply ( 200 , { 'ok' : true } ) ;
360360
361- cc = Cloudant ( { account : ME , password : PASSWORD , plugins : 'retry' } ) ;
361+ cc = Cloudant ( { url : SERVER , username : ME , password : PASSWORD , plugins : 'retry' } ) ;
362362 cc . db . create ( dbName , function ( er , d ) {
363363 should ( er ) . equal ( null ) ;
364364 d . should . be . an . Object ;
@@ -465,7 +465,7 @@ describe('Changes query', function() {
465465 } ) ;
466466} ) ;
467467
468- describe ( 'Changes follower' , function ( ) {
468+ describe ( '#db Changes follower' , function ( ) {
469469 var dbName ;
470470
471471 before ( function ( done ) {
@@ -474,7 +474,7 @@ describe('Changes follower', function() {
474474 var mocks = nock ( SERVER )
475475 . put ( '/' + dbName ) . reply ( 200 , { 'ok' : true } ) ;
476476
477- cc = Cloudant ( { account : ME , password : PASSWORD , plugins : 'retry' } ) ;
477+ cc = Cloudant ( { url : SERVER , username : ME , password : PASSWORD , plugins : 'retry' } ) ;
478478 cc . db . create ( dbName , function ( er , d ) {
479479 should ( er ) . equal ( null ) ;
480480 d . should . be . an . Object ;
@@ -606,7 +606,7 @@ describe('Changes follower', function() {
606606 } ) ;
607607} ) ;
608608
609- describe ( 'Cloudant Query' , function ( ) {
609+ describe ( '#db Cloudant Query' , function ( ) {
610610 var dbName ;
611611
612612 before ( function ( done ) {
@@ -615,7 +615,7 @@ describe('Cloudant Query', function() {
615615 var mocks = nock ( SERVER )
616616 . put ( '/' + dbName ) . reply ( 200 , { 'ok' : true } ) ;
617617
618- cc = Cloudant ( { account : ME , password : PASSWORD , plugins : 'retry' } ) ;
618+ cc = Cloudant ( { url : SERVER , username : ME , password : PASSWORD , plugins : 'retry' } ) ;
619619 cc . db . create ( dbName , function ( er , d ) {
620620 should ( er ) . equal ( null ) ;
621621 d . should . be . an . Object ;
@@ -749,7 +749,7 @@ describe('Cloudant Query', function() {
749749 } ) ;
750750} ) ;
751751
752- describe ( 'Cloudant Search' , function ( ) {
752+ describe ( '#db Cloudant Search' , function ( ) {
753753 var dbName ;
754754
755755 before ( function ( done ) {
@@ -758,7 +758,7 @@ describe('Cloudant Search', function() {
758758 var mocks = nock ( SERVER )
759759 . put ( '/' + dbName ) . reply ( 200 , { 'ok' : true } ) ;
760760
761- cc = Cloudant ( { account : ME , password : PASSWORD , plugins : 'retry' } ) ;
761+ cc = Cloudant ( { url : SERVER , username : ME , password : PASSWORD , plugins : 'retry' } ) ;
762762 cc . db . create ( dbName , function ( er , d ) {
763763 should ( er ) . equal ( null ) ;
764764 d . should . be . an . Object ;
@@ -938,7 +938,7 @@ describe('Gzip header tests', function() {
938938} ) ;
939939
940940if ( ! process . env . NOCK_OFF ) {
941- describe ( 'Gzip attachment tests' , test_gzip ) ;
941+ describe ( '#db Gzip attachment tests' , test_gzip ) ;
942942}
943943function test_gzip ( ) {
944944 it ( 'checks that the zipped response is unzipped' , function ( done ) {
@@ -949,7 +949,7 @@ function test_gzip() {
949949 'content-type' : 'text/css'
950950 } ) ;
951951
952- var c = Cloudant ( { account : ME , password : PASSWORD , plugins : 'retry' } ) ;
952+ var c = Cloudant ( { url : SERVER , username : ME , password : PASSWORD , plugins : 'retry' } ) ;
953953 var mydb = c . db . use ( dbName ) ;
954954 mydb . attachment . get ( 'x' , 'y.css' , function ( er , data ) {
955955 should ( er ) . equal ( null ) ;
@@ -970,7 +970,7 @@ describe('Virtual Hosts', function() {
970970 var mocks = nock ( SERVER )
971971 . get ( '/_api/v2/user/virtual_hosts' ) . reply ( 200 , { 'virtual_hosts' : [ ] } ) ;
972972
973- var c = Cloudant ( { account : ME , password : PASSWORD , plugins : 'retry' } ) ;
973+ var c = Cloudant ( { url : SERVER , username : ME , password : PASSWORD , plugins : 'retry' } ) ;
974974 c . get_virtual_hosts ( function ( er , d ) {
975975 should ( er ) . equal ( null ) ;
976976 d . should . be . an . Object ;
@@ -986,7 +986,7 @@ describe('Virtual Hosts', function() {
986986 var mocks = nock ( SERVER )
987987 . post ( '/_api/v2/user/virtual_hosts' ) . reply ( 200 , { 'ok' : true } ) ;
988988
989- var c = Cloudant ( { account : ME , password : PASSWORD , plugins : 'retry' } ) ;
989+ var c = Cloudant ( { url : SERVER , username : ME , password : PASSWORD , plugins : 'retry' } ) ;
990990 c . add_virtual_host ( { host : myHost , path : '/mypath' } , function ( er , d ) {
991991 should ( er ) . equal ( null ) ;
992992 d . should . be . an . Object ;
@@ -1003,7 +1003,7 @@ describe('Virtual Hosts', function() {
10031003 var mocks = nock ( SERVER )
10041004 . delete ( '/_api/v2/user/virtual_hosts' ) . reply ( 200 , { 'ok' : true } ) ;
10051005
1006- var c = Cloudant ( { account : ME , password : PASSWORD , plugins : 'retry' } ) ;
1006+ var c = Cloudant ( { url : SERVER , username : ME , password : PASSWORD , plugins : 'retry' } ) ;
10071007 c . delete_virtual_host ( { host : myHost , path : '/mypath' } , function ( er , d ) {
10081008 should ( er ) . equal ( null ) ;
10091009 d . should . be . an . Object ;
0 commit comments