Permalink
Browse files

Fix build trigger error on Jenkins v1.5xx when job requires auth #12 .

  • Loading branch information...
1 parent 3690877 commit b2f25cb92fafd4426ae2622b752c7b230733744a @cliffano committed Apr 5, 2013
Showing with 7 additions and 8 deletions.
  1. +1 −2 lib/jenkins.js
  2. +2 −2 package.json
  3. +4 −4 test/jenkins.js
View
@@ -43,14 +43,13 @@ function Jenkins(url) {
Jenkins.prototype.build = function (jobName, params, cb) {
var json = { parameter: [] },
- method = 'get';
+ method = 'post';
if (params) {
params.split('&').forEach(function (param) {
var keyVal = param.split('=');
json.parameter.push({ name: keyVal[0], value: keyVal[1] });
});
- method = 'post';
}
this.opts.queryStrings = { token: 'nestor', json: JSON.stringify(json) };
View
@@ -31,7 +31,7 @@
},
"dependencies": {
"async": "0.2.6",
- "bagofholding": "0.1.2",
+ "bagofholding": "0.1.3",
"colors": "0.6.0-1",
"cron": "1.0.1",
"feedparser": "0.14.0",
@@ -55,4 +55,4 @@
"url": "http://github.com/cliffano/nestor/raw/master/LICENSE"
}
]
-}
+}
View
@@ -70,7 +70,7 @@ buster.testCase('jenkins - jenkins', {
buster.testCase('jenkins - build', {
'should pass error not found when job does not exist': function (done) {
var mockRequest = function (method, url, opts, cb) {
- assert.equals(method, 'get');
+ assert.equals(method, 'post');
assert.equals(url, 'http://localhost:8080/job/job1/build');
assert.equals(opts.queryStrings.token, 'nestor');
assert.equals(opts.queryStrings.json, '{"parameter":[]}');
@@ -86,7 +86,7 @@ buster.testCase('jenkins - build', {
},
'should pass error not allowed job requires build parameters': function (done) {
var mockRequest = function (method, url, opts, cb) {
- assert.equals(method, 'get');
+ assert.equals(method, 'post');
assert.equals(url, 'http://localhost:8080/job/job1/build');
assert.equals(opts.queryStrings.token, 'nestor');
assert.equals(opts.queryStrings.json, '{"parameter":[]}');
@@ -100,9 +100,9 @@ buster.testCase('jenkins - build', {
done();
});
},
- 'should use get method when job is not parameterised': function (done) {
+ 'should use post method when job is not parameterised': function (done) {
var mockRequest = function (method, url, opts, cb) {
- assert.equals(method, 'get');
+ assert.equals(method, 'post');
assert.equals(url, 'http://localhost:8080/job/job1/build');
assert.equals(opts.queryStrings.token, 'nestor');
assert.equals(opts.queryStrings.json, '{"parameter":[]}');

0 comments on commit b2f25cb

Please sign in to comment.