tests: in backend tests, use POST instead of GET for setText() and setHTML()

This is allowed starting from fc661ee13a ("core: allow URL parameters and POST
bodies to co-exist"), which landed in Etherpad 1.8.0. For the discussion, see
issue #3568.
This commit is contained in:
John McLear 2020-03-21 18:52:42 +00:00 committed by muxator
parent b2dc446740
commit 352b432ed1

View file

@ -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");
})
@ -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");
})
@ -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")
})
@ -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")
})
@ -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")
})