server rejects rename of entitys over 150 chars

This commit is contained in:
Henry Oswald 2014-10-07 11:16:26 +01:00
parent b01b05e49b
commit 8789a4bde1
2 changed files with 16 additions and 0 deletions

View file

@ -42,6 +42,8 @@ module.exports = EditorHttpController =
entity_id = req.params.entity_id
entity_type = req.params.entity_type
name = req.body.name
if name.length > 150
return res.send 400
EditorController.renameEntity project_id, entity_id, entity_type, name, (error) ->
return next(error) if error?
res.send 204

View file

@ -108,6 +108,20 @@ describe "EditorHttpController", ->
it "should send back a success response", ->
@res.send.calledWith(204).should.equal true
describe "renameEntity with long name", ->
beforeEach ->
@req.params =
Project_id: @project_id
entity_id: @entity_id = "entity-id-123"
entity_type: @entity_type = "entity-type"
@req.body =
name: @name = "EDMUBEEBKBXUUUZERMNSXFFWIBHGSDAWGMRIQWJBXGWSBVWSIKLFPRBYSJEKMFHTRZBHVKJSRGKTBHMJRXPHORFHAKRNPZGGYIOTEDMUBEEBKBXUUUZERMNSXFFWIBHGSDAWGMRIQWJBXGWSBVWSIKLFPRBYSJEKMFHTRZBHVKJSRGKTBHMJRXPHORFHAKRNPZGGYIOT"
@EditorController.renameEntity = sinon.stub().callsArg(4)
@EditorHttpController.renameEntity @req, @res
it "should send back a bad request status code", ->
@res.send.calledWith(400).should.equal true
describe "moveEntity", ->
beforeEach ->
@req.params =