From d7cd5086bd1dae3e3be4bada1f859b9a894363b8 Mon Sep 17 00:00:00 2001 From: AntonyAntonio Date: Tue, 3 Jan 2017 21:06:45 -0300 Subject: [PATCH] Guillermo - tests get/edit/recover-mail-templates [skip ci] --- tests/init.rb | 3 +++ tests/system/edit-mail-template.rb | 22 ++++++++++++++++++++++ tests/system/get-mail-templates.rb | 15 +++++++++++++++ tests/system/recover-mail-template.rb | 19 +++++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 tests/system/edit-mail-template.rb create mode 100644 tests/system/get-mail-templates.rb create mode 100644 tests/system/recover-mail-template.rb diff --git a/tests/init.rb b/tests/init.rb index a300a6fd..3eb51877 100644 --- a/tests/init.rb +++ b/tests/init.rb @@ -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' diff --git a/tests/system/edit-mail-template.rb b/tests/system/edit-mail-template.rb new file mode 100644 index 00000000..da539e53 --- /dev/null +++ b/tests/system/edit-mail-template.rb @@ -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 diff --git a/tests/system/get-mail-templates.rb b/tests/system/get-mail-templates.rb new file mode 100644 index 00000000..8e067655 --- /dev/null +++ b/tests/system/get-mail-templates.rb @@ -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 diff --git a/tests/system/recover-mail-template.rb b/tests/system/recover-mail-template.rb new file mode 100644 index 00000000..0335da96 --- /dev/null +++ b/tests/system/recover-mail-template.rb @@ -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