Add test for creating pads with bad characters

This commit is contained in:
Stefan 2015-04-11 15:50:51 +02:00
parent 601be46993
commit 83094e0dfd
1 changed files with 20 additions and 1 deletions

View File

@ -2,7 +2,8 @@ var assert = require('assert')
supertest = require(__dirname+'/../../../../src/node_modules/supertest'),
fs = require('fs'),
api = supertest('http://localhost:9001');
path = require('path');
path = require('path'),
async = require(__dirname+'/../../../../src/node_modules/async');
var filePath = path.join(__dirname, '../../../../APIKEY.txt');
@ -80,6 +81,7 @@ describe('Permission', function(){
-> setHTML(padID) -- Should fail on invalid HTML
-> setHTML(padID) *3 -- Should fail on invalid HTML
-> getHTML(padID) -- Should return HTML close to posted HTML
-> createPad -- Tries to create pads with bad url characters
*/
@ -494,6 +496,23 @@ describe('getHTML', function(){
});
})
describe('createPad', function(){
it('errors if pad can be created', function(done) {
var badUrlChars = ["/", "%23", "%3F", "%26"];
async.map(
badUrlChars,
function (badUrlChar, cb) {
api.get(endPoint('createPad')+"&padID="+badUrlChar)
.expect(function(res){
if(res.body.code !== 1) throw new Error("Pad with bad characters was created");
})
.expect('Content-Type', /json/)
.end(cb);
},
done);
});
})
/*
-> movePadForce Test