@@ -24,10 +24,39 @@ describe "Node Jira Tests", ->
24
24
options =
25
25
rejectUnauthorized : true
26
26
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
28
28
spyOn @jira , ' request'
29
29
@cb = jasmine .createSpy ' callback'
30
30
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
+
31
60
it " Sets basic auth if oauth is not passed in" , ->
32
61
options =
33
62
rejectUnauthorized : false
@@ -44,7 +73,7 @@ describe "Node Jira Tests", ->
44
73
access_token : ' ac'
45
74
access_token_secret : ' acs'
46
75
# 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
48
77
spyOn @jira , ' request'
49
78
50
79
@jira .doRequest options, @cb
0 commit comments