@@ -24,10 +24,39 @@ describe "Node Jira Tests", ->
2424 options =
2525 rejectUnauthorized : true
2626 headers : ' Authorization' : ' Basic ' + bufferFrom (' test:test' ).toString (' base64' )
27- @jira = new nodeJira.JiraApi ' http' , ' localhost' , 80 , 2 , false , null , options
27+ @jira = new nodeJira.JiraApiWithOptions ' http' , ' localhost' , 80 , 2 , false , null , options
2828 spyOn @jira , ' request'
2929 @cb = jasmine .createSpy ' callback'
3030
31+ it " Sets basic auth if oauth is not passed in with JiraApi old method" , ->
32+ options =
33+ rejectUnauthorized : false ,
34+ auth :
35+ user : ' test'
36+ pass : ' test'
37+ @jira = new nodeJira.JiraApi ' http' , ' localhost' , 80 , ' test' , ' test' , 2
38+ spyOn @jira , ' request'
39+
40+ @jira .doRequest options, @cb
41+ expect (@jira .request )
42+ .toHaveBeenCalledWith (options, jasmine .any (Function ))
43+
44+ it " Sets OAuth oauth for the requests if oauth is passed in with JiraApi old method" , ->
45+ options =
46+ rejectUnauthorized : false ,
47+ oauth :
48+ consumer_key : ' ck'
49+ consumer_secret : ' cs'
50+ access_token : ' ac'
51+ access_token_secret : ' acs'
52+ # oauth = new OAuth.OAuth(null, null, oauth.consumer_key, oauth.consumer_secret, null, null, "RSA-SHA1")
53+ @jira = new nodeJira.JiraApi ' http' , ' localhost' , 80 , ' test' , ' test' , 2 , false , false , options .oauth
54+ spyOn @jira , ' request'
55+
56+ @jira .doRequest options, @cb
57+ expect (@jira .request )
58+ .toHaveBeenCalledWith (options, jasmine .any (Function ))
59+
3160 it " Sets basic auth if oauth is not passed in" , ->
3261 options =
3362 rejectUnauthorized : false
@@ -44,7 +73,7 @@ describe "Node Jira Tests", ->
4473 access_token : ' ac'
4574 access_token_secret : ' acs'
4675 # oauth = new OAuth.OAuth(null, null, oauth.consumer_key, oauth.consumer_secret, null, null, "RSA-SHA1")
47- @jira = new nodeJira.JiraApi ' http' , ' localhost' , 80 , 2 , false , null , options
76+ @jira = new nodeJira.JiraApiWithOptions ' http' , ' localhost' , 80 , 2 , false , null , options
4877 spyOn @jira , ' request'
4978
5079 @jira .doRequest options, @cb
0 commit comments