2016-07-27 05:44:07 +02:00
|
|
|
describe '/system/init-settings' do
|
2018-01-11 22:51:07 +01:00
|
|
|
it 'should prevent initing database if already called' do
|
|
|
|
result = request('/system/init-database', {})
|
|
|
|
(result['status']).should.equal('fail')
|
|
|
|
(result['message']).should.equal('INIT_SETTINGS_DONE')
|
|
|
|
|
|
|
|
result = request('/system/check-requirements', {})
|
|
|
|
(result['status']).should.equal('success')
|
|
|
|
|
|
|
|
result = request('/system/init-database', {})
|
|
|
|
(result['status']).should.equal('fail')
|
|
|
|
(result['message']).should.equal('INIT_SETTINGS_DONE')
|
|
|
|
end
|
|
|
|
|
2016-07-27 05:44:07 +02:00
|
|
|
it 'should initialize correctly' do
|
2017-03-15 20:17:06 +01:00
|
|
|
result = request('/system/init-settings', {
|
|
|
|
'registration' => true,
|
2017-06-13 23:12:10 +02:00
|
|
|
'title' => 'Support Center',
|
2019-01-12 04:38:33 +01:00
|
|
|
'smtp-host' => 'localhost:7070',
|
2019-01-12 08:43:02 +01:00
|
|
|
'smtp-user' => 'testemail@opensupports.com',
|
2019-01-12 04:38:33 +01:00
|
|
|
'smtp-pass' => 'password',
|
2019-01-12 08:43:02 +01:00
|
|
|
'server-email' => 'testemail@opensupports.com',
|
2020-05-13 00:22:51 +02:00
|
|
|
'language' => 'en',
|
|
|
|
'mandatory-login' => true
|
2017-03-15 20:17:06 +01:00
|
|
|
})
|
2016-07-27 05:44:07 +02:00
|
|
|
|
|
|
|
(result['status']).should.equal('success')
|
2018-03-28 04:30:18 +02:00
|
|
|
|
|
|
|
lang = $database.getRow('setting', 'language', 'name')
|
2016-07-27 05:44:07 +02:00
|
|
|
(lang['value']).should.equal('en')
|
2020-06-15 21:27:45 +02:00
|
|
|
|
|
|
|
default = $database.getRow('setting', 'default-department-id', 'name')
|
|
|
|
(default['value']).should.equal('1')
|
|
|
|
|
|
|
|
locked = $database.getRow('setting', 'default-is-locked', 'name')
|
|
|
|
(locked['value']).should.equal('0')
|
2017-03-15 20:17:06 +01:00
|
|
|
|
|
|
|
result = request('/system/init-admin', {
|
|
|
|
name: 'Emilia Clarke',
|
|
|
|
email: $staff[:email],
|
|
|
|
password: $staff[:password]
|
|
|
|
})
|
|
|
|
|
|
|
|
(result['status']).should.equal('success')
|
2016-07-27 05:44:07 +02:00
|
|
|
end
|
2018-01-11 22:51:07 +01:00
|
|
|
end
|