Guillermo - path edit-settings tests[skip ci]

This commit is contained in:
AntonyAntonio 2016-12-19 23:17:35 -03:00
parent 8aaca982d6
commit 83edf85f3d
4 changed files with 70 additions and 11 deletions

View File

@ -13,19 +13,20 @@ class EditSettingsController extends Controller {
public function handler() {
$settings = [
'manteniance-mode',
'system-title',
'timezone',
'layout',
'smtp-server',
'smtp-email',
'smtp-password',
'smtp-port',
'default-language',
'language',
'recaptcha-public',
'recaptcha-private',
'no-reply-email',
'smtp-host',
'smtp-port',
'smtp-user',
'smtp-pass',
'time-zone',
'maintenance-mode',
'layout',
'allow-attachments',
'max-size'
'max-size',
'system-title'
];
foreach($settings as $setting) {

View File

@ -38,7 +38,7 @@ class InitSettingsController extends Controller {
'layout' => 'boxed',
'allow-attachments' => 0,
'max-size' => 0,
'system-title' => 'Support Center'
]);
}

View File

@ -11,6 +11,7 @@ require './scripts.rb'
# TESTS
require './system/init-settings.rb'
require './system/get-settings.rb'
require './system/edit-settings.rb'
require './user/signup.rb'
require './user/login.rb'
require './user/send-recover-password.rb'

View File

@ -0,0 +1,57 @@
describe'system/edit-settings' do
request('/user/logout')
Scripts.login($staff[:email], $staff[:password], true)
it 'should edit settings' do
result= request('/system/edit-settings', {
"csrf_userid" => $csrf_userid,
"csrf_token" => $csrf_token,
"maintenance-mode" => 1,
"time-zone" => -3,
"layout" => 'full-width',
"allow-attachments" => 1,
"max-size" => 2,
"language" => 'es',
"no-reply-email" => 'testemail@hotmail.com',
"smtp-host" => 'www.opensupports.com',
"smtp-port" => 18,
"smtp-user" => 'admin',
"smtp-pass" => 'pass1234',
})
puts result['message']
(result['status']).should.equal('success')
row = $database.getRow('setting', 'maintenance-mode', 'name')
(row['value']).should.equal('1')
row = $database.getRow('setting', 'time-zone', 'name')
(row['value']).should.equal('-3')
row = $database.getRow('setting', 'layout', 'name')
(row['value']).should.equal('full-width')
row = $database.getRow('setting', 'max-size', 'name')
(row['value']).should.equal('2')
row = $database.getRow('setting', 'language', 'name')
(row['value']).should.equal('es')
row = $database.getRow('setting', 'no-reply-email', 'name')
(row['value']).should.equal('testemail@hotmail.com')
row = $database.getRow('setting', 'smtp-host', 'name')
(row['value']).should.equal('www.opensupports.com')
row = $database.getRow('setting', 'smtp-port', 'name')
(row['value']).should.equal('18')
row = $database.getRow('setting', 'smtp-user', 'name')
(row['value']).should.equal('admin')
row = $database.getRow('setting', 'smtp-pass', 'name')
(row['value']).should.equal('pass1234')
request('/user/logout')
end
end