2016-12-12 06:12:17 +01:00
|
|
|
describe'system/add-department' do
|
|
|
|
request('/user/logout')
|
|
|
|
Scripts.login($staff[:email], $staff[:password], true)
|
|
|
|
|
|
|
|
it 'should add department' do
|
2017-03-15 20:17:06 +01:00
|
|
|
result = request('/system/add-department', {
|
2016-12-12 06:12:17 +01:00
|
|
|
csrf_userid: $csrf_userid,
|
|
|
|
csrf_token: $csrf_token,
|
|
|
|
name: 'new department'
|
|
|
|
})
|
|
|
|
|
|
|
|
(result['status']).should.equal('success')
|
|
|
|
|
|
|
|
row = $database.getRow('department', 4, 'id')
|
|
|
|
|
|
|
|
(row['name']).should.equal('new department')
|
2016-12-29 21:25:45 +01:00
|
|
|
|
|
|
|
lastLog = $database.getLastRow('log')
|
|
|
|
(lastLog['type']).should.equal('ADD_DEPARTMENT')
|
2016-12-12 06:12:17 +01:00
|
|
|
end
|
2016-12-29 21:25:45 +01:00
|
|
|
end
|