Ivan - Add CustomResponse tests [skip ci]

This commit is contained in:
ivan 2016-10-04 18:42:47 -03:00
parent 684bdb1a25
commit 2b50837603
8 changed files with 42 additions and 42 deletions

View File

@ -1,20 +1,20 @@
<?php
class ERRORS {
const INVALID_CREDENTIALS = 'User or password is not defined';
const SESSION_EXISTS = 'User is already logged in';
const USER_EXISTS = 'Email already exists';
const NO_PERMISSION = 'You have no permission to access';
const INVALID_TITLE = 'Invalid title';
const INVALID_CONTENT = 'Invalid content';
const INVALID_EMAIL = 'Invalid email';
const INVALID_PASSWORD = 'Invalid password';
const INVALID_NAME = 'Invalid name';
const INVALID_SETTING = 'Invalid setting';
const INVALID_DEPARTMENT = 'Invalid department';
const INVALID_TICKET = 'Invalid ticket';
const INIT_SETTINGS_DONE = 'Settings already initialized';
const INVALID_OLD_PASSWORD = 'Invalid old password';
const INVALID_CAPTCHA = 'Invalid captcha';
const INVALID_CREDENTIALS = 'INVALID_CREDENTIALS';
const SESSION_EXISTS = 'SESSION_EXISTS';
const USER_EXISTS = 'USER_EXISTS';
const NO_PERMISSION = 'NO_PERMISSION';
const INVALID_TITLE = 'INVALID_TITLE';
const INVALID_CONTENT = 'INVALID_CONTENT';
const INVALID_EMAIL = 'INVALID_EMAIL';
const INVALID_PASSWORD = 'INVALID_PASSWORD';
const INVALID_NAME = 'INVALID_NAME';
const INVALID_SETTING = 'INVALID_SETTING';
const INVALID_DEPARTMENT = 'INVALID_DEPARTMENT';
const INVALID_TICKET = 'INVALID_TICKET';
const INIT_SETTINGS_DONE = 'INIT_SETTINGS_DONE';
const INVALID_OLD_PASSWORD = 'INVALID_OLD_PASSWORD';
const INVALID_CAPTCHA = 'INVALID_CAPTCHA';
const INVALID_TICKET_EVENT = 'INVALID_TICKET_EVENT';
const INVALID_LANGUAGE = 'INVALID_LANGUAGE';
}

View File

@ -15,7 +15,7 @@ describe '/ticket/comment/' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('You have no permission to access')
(result['message']).should.equal('NO_PERMISSION')
end
it 'should fail if content is too short' do
@ -27,7 +27,7 @@ describe '/ticket/comment/' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid content')
(result['message']).should.equal('INVALID_CONTENT')
end
it 'should fail if content is very long' do
@ -42,7 +42,7 @@ describe '/ticket/comment/' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid content')
(result['message']).should.equal('INVALID_CONTENT')
end
it 'should fail if ticket does not exist' do
@ -54,7 +54,7 @@ describe '/ticket/comment/' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid ticket')
(result['message']).should.equal('INVALID_TICKET')
end
it 'should add comment to ticket' do
@ -86,7 +86,7 @@ describe '/ticket/comment/' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('You have no permission to access')
(result['message']).should.equal('NO_PERMISSION')
end
#it 'should add comment if logged as ticket owner' do

View File

@ -12,7 +12,7 @@ describe '/ticket/create' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('You have no permission to access')
(result['message']).should.equal('NO_PERMISSION')
end
@ -25,7 +25,7 @@ describe '/ticket/create' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid title')
(result['message']).should.equal('INVALID_TITLE')
end
it 'should fail if title is very long' do
@ -37,7 +37,7 @@ describe '/ticket/create' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid title')
(result['message']).should.equal('INVALID_TITLE')
end
it 'should fail if content is too short' do
@ -50,7 +50,7 @@ describe '/ticket/create' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid content')
(result['message']).should.equal('INVALID_CONTENT')
end
it 'should fail if content is very long' do
@ -66,7 +66,7 @@ describe '/ticket/create' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid content')
(result['message']).should.equal('INVALID_CONTENT')
end
@ -80,7 +80,7 @@ describe '/ticket/create' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid department')
(result['message']).should.equal('INVALID_DEPARTMENT')
end

View File

@ -17,7 +17,7 @@ describe '/user/edit-email' do
csrf_token: $csrf_token
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid email')
(result['message']).should.equal('INVALID_EMAIL')
result = request('/user/edit-email', {
newEmail: 'newemailjobs.com',
@ -25,7 +25,7 @@ describe '/user/edit-email' do
csrf_token: $csrf_token
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid email')
(result['message']).should.equal('INVALID_EMAIL')
end
it 'should change email' do

View File

@ -18,7 +18,7 @@ describe '/user/edit-password' do
csrf_token: $csrf_token
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid password')
(result['message']).should.equal('INVALID_PASSWORD')
long_text = ''
250.times {long_text << 'a'}
@ -30,7 +30,7 @@ describe '/user/edit-password' do
csrf_token: $csrf_token
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid password')
(result['message']).should.equal('INVALID_PASSWORD')
end
it 'should fail if old password is not same than old password ' do
@ -41,7 +41,7 @@ describe '/user/edit-password' do
csrf_token: $csrf_token
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid old password')
(result['message']).should.equal('INVALID_OLD_PASSWORD')
end
it 'should change password' do

View File

@ -29,7 +29,7 @@ describe '/user/login' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('User is already logged in')
(result['message']).should.equal('SESSION_EXISTS')
end
it 'should login staff member' do

View File

@ -9,7 +9,7 @@ describe '/user/recover-password' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid email')
(result['message']).should.equal('INVALID_EMAIL')
result = request('/user/recover-password', {
email: 'loginos4.com',
@ -17,7 +17,7 @@ describe '/user/recover-password' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid email')
(result['message']).should.equal('INVALID_EMAIL')
end
it 'should fail if password is incorrect' do
@ -47,6 +47,6 @@ describe '/user/recover-password' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('You have no permission to access')
(result['message']).should.equal('NO_PERMISSION')
end
end

View File

@ -23,7 +23,7 @@ describe '/user/signup' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid name')
(result['message']).should.equal('INVALID_NAME')
result = request('/user/signup', {
name: long_text,
@ -32,7 +32,7 @@ describe '/user/signup' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid name')
(result['message']).should.equal('INVALID_NAME')
result = request('/user/signup', {
name: 'tyri0n',
@ -41,7 +41,7 @@ describe '/user/signup' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid name')
(result['message']).should.equal('INVALID_NAME')
end
it 'should fail if email is invalid' do
@ -52,7 +52,7 @@ describe '/user/signup' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid email')
(result['message']).should.equal('INVALID_EMAIL')
result = request('/user/signup', {
name: 'tyrion',
@ -61,7 +61,7 @@ describe '/user/signup' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid email')
(result['message']).should.equal('INVALID_EMAIL')
end
it 'should fail if password is invalid' do
@ -72,7 +72,7 @@ describe '/user/signup' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid password')
(result['message']).should.equal('INVALID_PASSWORD')
long_text = ''
250.times {long_text << 'a'}
@ -84,7 +84,7 @@ describe '/user/signup' do
})
(result['status']).should.equal('fail')
(result['message']).should.equal('Invalid password')
(result['message']).should.equal('INVALID_PASSWORD')
end
end