mirror of
https://github.com/appium/appium.git
synced 2026-04-29 23:09:31 -05:00
make sure /sessions doesn't return false hard-coded information
Fixes #400
This commit is contained in:
+9
-2
@@ -177,8 +177,15 @@ exports.getSession = function(req, res) {
|
||||
};
|
||||
|
||||
exports.getSessions = function(req, res) {
|
||||
respondSuccess(req, res,
|
||||
[{id: req.appium.sessionId , capabilities: req.device.capabilities}]);
|
||||
var sessions = [];
|
||||
if (req.appium.sessionId !== null) {
|
||||
sessions.push({
|
||||
id: req.appium.sessionId
|
||||
, capabilities: req.device.capabilities
|
||||
});
|
||||
}
|
||||
|
||||
respondSuccess(req, res, sessions);
|
||||
};
|
||||
|
||||
exports.reset = function(req, res) {
|
||||
|
||||
@@ -19,7 +19,7 @@ var describeWithSession = function(desc, tests) {
|
||||
should.not.exist(err);
|
||||
res.statusCode.should.equal(303);
|
||||
should.ok(res.headers.location);
|
||||
request.get(serverUrl + res.headers.location, function(err, res, body) {
|
||||
request.get(res.headers.location, function(err, res, body) {
|
||||
should.not.exist(err);
|
||||
res.statusCode.should.equal(200);
|
||||
body = JSON.parse(body);
|
||||
@@ -54,6 +54,15 @@ describe('JSONWP request', function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('to get list of sessions', function() {
|
||||
it('should return empty list if no session active', function(done) {
|
||||
request.get(serverHub + 's', function(err, res, body) {
|
||||
should.not.exist(err);
|
||||
JSON.parse(body).value.should.eql([]);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('to a not-yet-implemented url', function() {
|
||||
it('should respond with 501 Not Implemented', function(done) {
|
||||
var url = serverHub + '/fakesessid/ime/deactivate';
|
||||
|
||||
Reference in New Issue
Block a user