Skip to content

Commit

Permalink
tests: in backend tests, use POST instead of GET for setText() and se…
Browse files Browse the repository at this point in the history
…tHTML()

This is allowed starting from fc661ee ("core: allow URL parameters and POST
bodies to co-exist"), which landed in Etherpad 1.8.0. For the discussion, see
issue ether#3568.
  • Loading branch information
JohnMcLear committed Mar 21, 2020
1 parent 404c66a commit 117deb3
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions tests/backend/specs/api/pad.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,11 @@ describe('getText', function(){

describe('setText', function(){
it('creates a new Pad with text', function(done) {
api.get(endPoint('setText')+"&padID="+testPadId+"&text=testTextTwo")
api.post(endPoint('setText'))
.send({
"padID": testPadId,
"text": "testTextTwo",
})
.expect(function(res){
if(res.body.code !== 0) throw new Error("Pad setting text failed");
})
Expand Down Expand Up @@ -334,7 +338,11 @@ describe('getLastEdited', function(){

describe('setText', function(){
it('creates a new Pad with text', function(done) {
api.get(endPoint('setText')+"&padID="+testPadId+"&text=testTextTwo")
api.post(endPoint('setText'))
.send({
"padID": testPadId,
"text": "testTextTwo",
})
.expect(function(res){
if(res.body.code !== 0) throw new Error("Pad setting text failed");
})
Expand Down Expand Up @@ -394,8 +402,11 @@ describe('createPad', function(){

describe('setText', function(){
it('Sets text on a pad Id', function(done) {
api.post(endPoint('setText')+"&padID="+testPadId)
.send({text: text})
api.post(endPoint('setText'))
.send({
"padID": testPadId,
"text": text,
})
.expect(function(res){
if(res.body.code !== 0) throw new Error("Pad Set Text failed")
})
Expand Down Expand Up @@ -533,7 +544,11 @@ describe('getText', function(){
describe('setHTML', function(){
it('Sets the HTML of a Pad attempting to pass ugly HTML', function(done) {
var html = "<div><b>Hello HTML</title></head></div>";
api.get(endPoint('setHTML')+"&padID="+testPadId+"&html="+html)
api.post(endPoint('setHTML'))
.send({
"padID": testPadId,
"html": html,
})
.expect(function(res){
if(res.body.code !== 1) throw new Error("Allowing crappy HTML to be imported")
})
Expand All @@ -544,7 +559,11 @@ describe('setHTML', function(){

describe('setHTML', function(){
it('Sets the HTML of a Pad with complex nested lists of different types', function(done) {
api.get(endPoint('setHTML')+"&padID="+testPadId+"&html="+ulHtml)
api.post(endPoint('setHTML'))
.send({
"padID": testPadId,
"html": ulHtml,
})
.expect(function(res){
if(res.body.code !== 0) throw new Error("List HTML cant be imported")
})
Expand Down

0 comments on commit 117deb3

Please sign in to comment.