Ivan - Update comment tests [skip ci]

This commit is contained in:
ivan 2016-09-29 14:41:59 -03:00
parent 0bed4bef45
commit 34d8e9702b
3 changed files with 15 additions and 4 deletions

View File

@ -68,9 +68,10 @@ describe '/ticket/comment/' do
(result['status']).should.equal('success')
ticket = $database.getRow('ticket', @ticketNumber, 'ticket_number')
comment = $database.getRow('comment', ticket['id'], 'ticket_id')
comment = $database.getRow('ticketevent', ticket['id'], 'ticket_id')
(comment['content']).should.equal('some comment content')
(comment['author_id']).should.equal($csrf_userid)
(comment['type']).should.equal('COMMENT')
(comment['author_user_id']).should.equal($csrf_userid)
end
it 'should fail if user is not the author nor owner' do

View File

@ -15,6 +15,13 @@ describe '/ticket/get/' do
csrf_token: $csrf_token
})
@ticketNumber = result['data']['ticketNumber']
request('/ticket/comment', {
ticketNumber: @ticketNumber,
content: 'some valid comment made',
csrf_userid: $csrf_userid,
csrf_token: $csrf_token
})
end
it 'should fail if ticketNumber is invalid' do
@ -46,6 +53,7 @@ describe '/ticket/get/' do
result = Scripts.login('cersei@os4.com', 'cersei')
$csrf_userid = result['userId']
$csrf_token = result['token']
result = request('/ticket/get', {
ticketNumber: @ticketNumber,
csrf_userid: $csrf_userid,
@ -68,6 +76,8 @@ describe '/ticket/get/' do
(result['data']['author']['name']).should.equal('Cersei Lannister')
(result['data']['author']['email']).should.equal('cersei@os4.com')
(result['data']['owner']).should.equal([])
(result['data']['comments']).should.equal([])
(result['data']['events'].size).should.equal(1)
(result['data']['events'][0]['type']).should.equal('COMMENT')
(result['data']['events'][0]['content']).should.equal('some valid comment made')
end
end

View File

@ -52,6 +52,6 @@ describe '/user/get' do
(ticketFromUser['author']['name']).should.equal('User Get')
(ticketFromUser['author']['email']).should.equal('user_get@os4.com')
(ticketFromUser['owner']).should.equal([])
(ticketFromUser['comments']).should.equal([])
(ticketFromUser['events']).should.equal([])
end
end