-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#178 Place app.use for executor in the right order.
Added tests for raw rest commands
- Loading branch information
pmeijer
committed
Feb 24, 2015
1 parent
18cd762
commit d531f75
Showing
2 changed files
with
69 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/*globals require, describe, it, afterEach, WebGMEGlobal, WebGME*/ | ||
|
||
/** | ||
* @author pmeijer / https://github.com/pmeijer | ||
*/ | ||
|
||
require('../../_globals.js'); | ||
|
||
var agent = require('superagent').agent(), | ||
should = require('chai').should(), | ||
server, | ||
serverBaseUrl; | ||
|
||
describe('Executor', function () { | ||
'use strict'; | ||
|
||
afterEach(function (done) { | ||
server.stop(done); | ||
}); | ||
|
||
it('should return 200 at rest/executor/worker/ with enableExecutor=true', function (done) { | ||
var config = WebGMEGlobal.getConfig(); | ||
config.port = 9001; | ||
config.enableExecutor = true; | ||
|
||
serverBaseUrl = 'http://127.0.0.1:' + config.port; | ||
|
||
server = WebGME.standaloneServer(config); | ||
server.start(function () { | ||
agent.get(serverBaseUrl + '/rest/executor/worker/').end(function (err, res) { | ||
if (err) { | ||
done(err); | ||
return; | ||
} | ||
should.equal(res.status, 200); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
it('should return 404 at rest/executor/worker/ with enableExecutor=false', function (done) { | ||
var config = WebGMEGlobal.getConfig(); | ||
config.port = 9001; | ||
config.enableExecutor = false; | ||
|
||
serverBaseUrl = 'http://127.0.0.1:' + config.port; | ||
|
||
server = WebGME.standaloneServer(config); | ||
server.start(function () { | ||
agent.get(serverBaseUrl + '/rest/executor/worker/').end(function (err, res) { | ||
if (err) { | ||
done(err); | ||
return; | ||
} | ||
should.equal(res.status, 404); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |