commit
92012d639b
|
@ -69,6 +69,16 @@ class Scripts
|
|||
result['data']
|
||||
end
|
||||
|
||||
def self.closeTicket(ticketNumber)
|
||||
result = request('/ticket/close', {
|
||||
ticketNumber:ticketNumber,
|
||||
csrf_userid: $csrf_userid,
|
||||
csrf_token: $csrf_token
|
||||
})
|
||||
|
||||
result['data']
|
||||
end
|
||||
|
||||
def self.createAPIKey(name)
|
||||
request('/system/add-api-key', {
|
||||
csrf_userid: $csrf_userid,
|
||||
|
|
|
@ -10,6 +10,6 @@ describe '/staff/get-new-tickets' do
|
|||
})
|
||||
|
||||
(result['status']).should.equal('success')
|
||||
(result['data'].size).should.equal(7)
|
||||
(result['data'].size).should.equal(9)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ describe'system/disable-user-system' do
|
|||
|
||||
numberOftickets= $database.query("SELECT * FROM ticket WHERE author_id IS NULL AND author_email IS NOT NULL AND author_name IS NOT NULL")
|
||||
|
||||
(numberOftickets.num_rows).should.equal(36)
|
||||
(numberOftickets.num_rows).should.equal(38)
|
||||
|
||||
request('/user/logout')
|
||||
|
||||
|
@ -92,7 +92,7 @@ describe'system/disable-user-system' do
|
|||
|
||||
numberOftickets= $database.query("SELECT * FROM ticket WHERE author_email IS NULL AND author_name IS NULL AND author_id IS NOT NULL" )
|
||||
|
||||
(numberOftickets.num_rows).should.equal(37)
|
||||
(numberOftickets.num_rows).should.equal(39)
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@ describe '/ticket/close' do
|
|||
request('/user/logout')
|
||||
Scripts.login($staff[:email], $staff[:password], true)
|
||||
|
||||
#TODO: DO THINGS
|
||||
|
||||
it 'should close a ticket if everything is okey' do
|
||||
ticket = $database.getRow('ticket', 1 , 'id')
|
||||
|
||||
|
@ -21,5 +19,28 @@ describe '/ticket/close' do
|
|||
|
||||
lastLog = $database.getLastRow('log')
|
||||
(lastLog['type']).should.equal('CLOSE')
|
||||
|
||||
request('/user/logout')
|
||||
Scripts.createUser('closer@os4.com','closer','Closer')
|
||||
Scripts.login('closer@os4.com','closer')
|
||||
Scripts.createTicket('tickettoclose')
|
||||
|
||||
ticket = $database.getRow('ticket', 'tickettoclose', 'title')
|
||||
|
||||
result = request('/ticket/close', {
|
||||
ticketNumber: ticket['ticket_number'],
|
||||
csrf_userid: $csrf_userid,
|
||||
csrf_token: $csrf_token
|
||||
|
||||
})
|
||||
|
||||
(result['status']).should.equal('success')
|
||||
|
||||
ticket = $database.getRow('ticket', 'tickettoclose', 'title')
|
||||
(ticket['closed']).should.equal('1')
|
||||
|
||||
lastLog = $database.getLastRow('log')
|
||||
(lastLog['type']).should.equal('CLOSE')
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,8 +2,6 @@ describe '/ticket/re-open' do
|
|||
request('/user/logout')
|
||||
Scripts.login($staff[:email], $staff[:password], true)
|
||||
|
||||
#TODO: DO THINGS
|
||||
|
||||
it 'should re open a ticket if everything is okey' do
|
||||
ticket = $database.getRow('ticket', 1 , 'id')
|
||||
|
||||
|
@ -21,5 +19,28 @@ describe '/ticket/re-open' do
|
|||
|
||||
lastLog = $database.getLastRow('log')
|
||||
(lastLog['type']).should.equal('RE_OPEN')
|
||||
|
||||
request('/user/logout')
|
||||
Scripts.createUser('reopener@os4.com','reopener','Reopener')
|
||||
Scripts.login('reopener@os4.com','reopener')
|
||||
Scripts.createTicket('tickettoreopen')
|
||||
|
||||
ticket = $database.getRow('ticket', 'tickettoreopen', 'title')
|
||||
|
||||
Scripts.closeTicket(ticket['ticketNumber'])
|
||||
|
||||
result = request('/ticket/re-open', {
|
||||
ticketNumber: ticket['ticket_number'],
|
||||
csrf_userid: $csrf_userid,
|
||||
csrf_token: $csrf_token
|
||||
})
|
||||
|
||||
(result['status']).should.equal('success')
|
||||
|
||||
ticket = $database.getRow('ticket', 'tickettoreopen', 'title')
|
||||
(ticket['closed']).should.equal('0')
|
||||
|
||||
lastLog = $database.getLastRow('log')
|
||||
(lastLog['type']).should.equal('RE_OPEN')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -36,7 +36,7 @@ describe '/user/get-users' do
|
|||
})
|
||||
|
||||
(result['status']).should.equal('success')
|
||||
(result['data']['users'].size).should.equal(3)
|
||||
(result['data']['users'].size).should.equal(5)
|
||||
end
|
||||
|
||||
it 'should get users with order by tickets and asc' do
|
||||
|
|
Loading…
Reference in New Issue