opensupports/tests/staff/get.rb

34 lines
1.3 KiB
Ruby
Raw Normal View History

describe '/staff/get/' do
request('/user/logout')
Scripts.login($staff[:email], $staff[:password], true)
it 'should return staff member data' do
result = request('/staff/get', {
csrf_userid: $csrf_userid,
csrf_token: $csrf_token
})
(result['status']).should.equal('success')
(result['data']['name']).should.equal('Emilia Clarke')
(result['data']['staff']).should.equal(true)
2016-12-08 07:21:37 +01:00
(result['data']['email']).should.equal('staff@opensupports.com')
(result['data']['level']).should.equal('3')
(result['data']['sendEmailOnNewTicket']).should.equal('1')
2016-12-08 07:21:37 +01:00
end
it 'should return staff member data with staff Id' do
2018-10-29 23:32:03 +01:00
staff = $database.getRow('staff','tyrion@opensupports.com','email')
2016-12-08 07:21:37 +01:00
result = request('/staff/get', {
csrf_userid: $csrf_userid,
csrf_token: $csrf_token,
2018-10-29 23:32:03 +01:00
staffId: staff['id']
2016-12-08 07:21:37 +01:00
})
(result['status']).should.equal('success')
(result['data']['name']).should.equal('Tyrion Lannister')
(result['data']['staff']).should.equal(true)
(result['data']['email']).should.equal('tyrion@opensupports.com')
(result['data']['level']).should.equal('2')
(result['data']['sendEmailOnNewTicket']).should.equal('0')
end
2018-10-29 23:32:03 +01:00
end