2016-10-20 23:34:06 +02:00
|
|
|
describe '/ticket/seen' do
|
|
|
|
|
|
|
|
describe 'when a staff is logged' do
|
|
|
|
request('/user/logout')
|
|
|
|
Scripts.login($staff[:email], $staff[:password], true)
|
|
|
|
|
|
|
|
it 'should change unread if everything is okey ' do
|
2016-10-21 21:38:08 +02:00
|
|
|
ticket = $database.getRow('ticket', 1, 'id')
|
2016-10-20 23:34:06 +02:00
|
|
|
result = request('/ticket/seen', {
|
|
|
|
ticketNumber: ticket['ticket_number'],
|
|
|
|
csrf_userid: $csrf_userid,
|
|
|
|
csrf_token: $csrf_token
|
|
|
|
})
|
|
|
|
(result['status']).should.equal('success')
|
2016-10-21 21:38:08 +02:00
|
|
|
ticket = $database.getRow('ticket', 1, 'id')
|
|
|
|
(ticket['unreadStaff']).should.equal('0')
|
|
|
|
|
2016-10-20 23:34:06 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-09-28 02:19:34 +02:00
|
|
|
describe 'when an user is logged' do
|
2016-10-20 23:34:06 +02:00
|
|
|
|
2016-10-21 21:38:08 +02:00
|
|
|
request('/user/logout')
|
|
|
|
Scripts.login()
|
2016-10-20 23:34:06 +02:00
|
|
|
it 'should change unread if everything is okey ' do
|
2016-10-21 21:38:08 +02:00
|
|
|
ticket = $database.getRow('ticket', 1, 'id')
|
|
|
|
result = request('/ticket/seen', {
|
|
|
|
ticketNumber: ticket['ticket_number'],
|
|
|
|
csrf_userid: $csrf_userid,
|
|
|
|
csrf_token: $csrf_token
|
|
|
|
})
|
2016-10-20 23:34:06 +02:00
|
|
|
|
2016-10-21 21:38:08 +02:00
|
|
|
(result['status']).should.equal('success')
|
|
|
|
ticket = $database.getRow('ticket', 1, 'id')
|
|
|
|
(ticket['unread']).should.equal('0')
|
2016-10-20 23:34:06 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-09-28 02:19:34 +02:00
|
|
|
end
|