summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohn McLear <john@mclear.co.uk>2015-04-11 14:56:26 +0100
committerJohn McLear <john@mclear.co.uk>2015-04-11 14:56:26 +0100
commit5ef22e649b661e5a5f385a1cbfc3d0399b535e04 (patch)
treeff1ba7b425bb0e4060dc691a13ecbfbfb961ae5a /tests
parent27aa71f3a4085140b83b1fa59d0f20debe1cc294 (diff)
parent83094e0dfd3361625ec14442d58c1e8ba935810b (diff)
downloadetherpad-lite-5ef22e649b661e5a5f385a1cbfc3d0399b535e04.zip
Merge pull request #2302 from Gared/create_pad_special_characters
Add check for special url characters to createPad API function
Diffstat (limited to 'tests')
-rw-r--r--tests/backend/specs/api/pad.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/backend/specs/api/pad.js b/tests/backend/specs/api/pad.js
index 52849c2e..75e77971 100644
--- a/tests/backend/specs/api/pad.js
+++ b/tests/backend/specs/api/pad.js
@@ -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