Guillermo - tests get/edit/recover-mail-templates [skip ci]

This commit is contained in:
AntonyAntonio 2017-01-03 21:06:45 -03:00
parent 51357c2cd8
commit d7cd5086bd
4 changed files with 59 additions and 0 deletions

View File

@ -48,3 +48,6 @@ require './system/add-department.rb'
require './system/edit-department.rb'
require './system/delete-department.rb'
require './staff/last-events.rb'
require './system/get-mail-templates.rb'
require './system/edit-mail-template.rb'
require './system/recover-mail-template.rb'

View File

@ -0,0 +1,22 @@
describe'system/edit-mail-template' do
request('/user/logout')
Scripts.login($staff[:email], $staff[:password], true)
it 'should edit mail template' do
result= request('/system/edit-mail-template', {
csrf_userid: $csrf_userid,
csrf_token: $csrf_token,
language: 'en',
templateType: 'USER_SIGNUP',
subject: 'new subject',
body: 'new message'
})
(result['status']).should.equal('success')
row = $database.getRow('mailtemplate', 1, 'id')
(row['subject']).should.equal('new subject')
(row['body']).should.equal('new message')
end
end

View File

@ -0,0 +1,15 @@
describe'system/get-mail-templates' do
request('/user/logout')
Scripts.login($staff[:email], $staff[:password], true)
it 'should get mail templates' do
result= request('/system/get-mail-templates', {
csrf_userid: $csrf_userid,
csrf_token: $csrf_token
})
(result['status']).should.equal('success')
(result['data'].size).should.equal(10)
end
end

View File

@ -0,0 +1,19 @@
describe'system/recover-mail-template' do
request('/user/logout')
Scripts.login($staff[:email], $staff[:password], true)
it 'should recover mail template' do
result= request('/system/recover-mail-template', {
csrf_userid: $csrf_userid,
csrf_token: $csrf_token,
language: 'en',
templateType: 'USER_SIGNUP',
})
(result['status']).should.equal('success')
row = $database.getRow('mailtemplate', 1, 'id')
(row['subject']).should.equal('Signup {{to}} - OpenSupports')
end
end