2016-10-15 09:32:38 +02:00
|
|
|
describe '/ticket/change-priority' do
|
|
|
|
request('/user/logout')
|
|
|
|
Scripts.login($staff[:email], $staff[:password], true)
|
|
|
|
|
|
|
|
#TODO: things that Ivan don't forget
|
|
|
|
|
|
|
|
it 'should change priority to high if everything is okey' do
|
|
|
|
ticket = $database.getRow('ticket', 1 , 'id')
|
|
|
|
|
|
|
|
result = request('/ticket/change-priority', {
|
|
|
|
priority:'high',
|
|
|
|
ticketNumber: ticket['ticket_number'],
|
|
|
|
csrf_userid: $csrf_userid,
|
|
|
|
csrf_token: $csrf_token
|
|
|
|
})
|
|
|
|
|
|
|
|
(result['status']).should.equal('success')
|
|
|
|
|
|
|
|
ticket = $database.getRow('ticket', 1 , 'id')
|
|
|
|
(ticket['priority']).should.equal('high')
|
2016-10-21 21:38:08 +02:00
|
|
|
(ticket['unread']).should.equal('1')
|
2016-12-29 21:25:45 +01:00
|
|
|
|
|
|
|
lastLog = $database.getLastRow('log')
|
2017-01-06 22:40:33 +01:00
|
|
|
(lastLog['type']).should.equal('PRIORITY_CHANGED')
|
2016-10-15 09:32:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should change priority to medium if everything is okey' do
|
|
|
|
ticket = $database.getRow('ticket', 1 , 'id')
|
|
|
|
|
|
|
|
result = request('/ticket/change-priority', {
|
|
|
|
priority:'medium',
|
|
|
|
ticketNumber: ticket['ticket_number'],
|
|
|
|
csrf_userid: $csrf_userid,
|
|
|
|
csrf_token: $csrf_token
|
|
|
|
})
|
|
|
|
|
|
|
|
(result['status']).should.equal('success')
|
|
|
|
|
|
|
|
ticket = $database.getRow('ticket', 1 , 'id')
|
|
|
|
(ticket['priority']).should.equal('medium')
|
2016-10-21 21:38:08 +02:00
|
|
|
(ticket['unread']).should.equal('1')
|
2016-12-29 21:25:45 +01:00
|
|
|
|
|
|
|
lastLog = $database.getLastRow('log')
|
2017-01-06 22:40:33 +01:00
|
|
|
(lastLog['type']).should.equal('PRIORITY_CHANGED')
|
2016-10-15 09:32:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should change priority to low if everything is okey' do
|
|
|
|
ticket = $database.getRow('ticket', 1 , 'id')
|
|
|
|
|
|
|
|
result = request('/ticket/change-priority', {
|
|
|
|
priority:'low',
|
|
|
|
ticketNumber: ticket['ticket_number'],
|
|
|
|
csrf_userid: $csrf_userid,
|
|
|
|
csrf_token: $csrf_token
|
|
|
|
})
|
|
|
|
|
|
|
|
(result['status']).should.equal('success')
|
|
|
|
|
|
|
|
ticket = $database.getRow('ticket', 1 , 'id')
|
|
|
|
(ticket['priority']).should.equal('low')
|
2016-10-21 21:38:08 +02:00
|
|
|
(ticket['unread']).should.equal('1')
|
2016-12-29 21:25:45 +01:00
|
|
|
|
|
|
|
lastLog = $database.getLastRow('log')
|
2017-01-06 22:40:33 +01:00
|
|
|
(lastLog['type']).should.equal('PRIORITY_CHANGED')
|
2016-10-15 09:32:38 +02:00
|
|
|
end
|
|
|
|
|
2016-12-29 21:25:45 +01:00
|
|
|
end
|