Ivan - Fix ruby tests
This commit is contained in:
parent
d4263d4b94
commit
8d0da0e451
|
@ -10,7 +10,7 @@ describe'/staff/add' do
|
|||
email: 'tyrion@opensupports.com',
|
||||
password: 'testpassword',
|
||||
level: 2,
|
||||
profilePic: 'http://www.opensupports.com/profilepic.jpg',
|
||||
profilePic: '',
|
||||
departments: '[1]'
|
||||
})
|
||||
|
||||
|
@ -20,7 +20,7 @@ describe'/staff/add' do
|
|||
|
||||
(row['name']).should.equal('Tyrion Lannister')
|
||||
(row['email']).should.equal('tyrion@opensupports.com')
|
||||
(row['profile_pic']).should.equal('http://www.opensupports.com/profilepic.jpg')
|
||||
(row['profile_pic']).should.equal('')
|
||||
(row['level']).should.equal('2')
|
||||
|
||||
row = $database.getRow('department', 1, 'id')
|
||||
|
@ -38,7 +38,7 @@ describe'/staff/add' do
|
|||
email: 'tyrion@opensupports.com',
|
||||
password: 'testpassword',
|
||||
level: 2,
|
||||
profilePic: 'http://www.opensupports.com/profilepic.jpg',
|
||||
profilePic: '',
|
||||
departments: '[1]'
|
||||
})
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ describe'/staff/edit' do
|
|||
password: 'starkpassword',
|
||||
email: 'arya@opensupports.com',
|
||||
level: 2,
|
||||
profilePic: 'http://www.opensupports.com/profilepic.jpg',
|
||||
profilePic: '',
|
||||
departments: '[1]'
|
||||
})
|
||||
request('/user/logout')
|
||||
|
|
|
@ -12,7 +12,7 @@ describe'/staff/get-all' do
|
|||
|
||||
(result['data'][0]['name']).should.equal('Emilia Clarke')
|
||||
(result['data'][0]['email']).should.equal('staff@opensupports.com')
|
||||
(result['data'][0]['profilePic']).should.equal('http://www.opensupports.com/profilepic.jpg')
|
||||
(result['data'][0]['profilePic']).should.equal('')
|
||||
(result['data'][0]['level']).should.equal('3')
|
||||
(result['data'][0]['departments'][0]['id']).should.equal('1')
|
||||
(result['data'][0]['departments'][0]['name']).should.equal('Tech Support')
|
||||
|
@ -25,7 +25,7 @@ describe'/staff/get-all' do
|
|||
|
||||
(result['data'][1]['name']).should.equal('Arya Stark')
|
||||
(result['data'][1]['email']).should.equal('newwstaff@opensupports.com')
|
||||
(result['data'][1]['profilePic']).should.equal('http://www.opensupports.com/profilepic.jpg')
|
||||
(result['data'][1]['profilePic']).should.equal('')
|
||||
(result['data'][1]['level']).should.equal('2')
|
||||
(result['data'][1]['departments'][0]['id']).should.equal('1')
|
||||
(result['data'][1]['departments'][0]['name']).should.equal('Tech Support')
|
||||
|
|
|
@ -71,4 +71,26 @@ describe 'File Upload and Download' do
|
|||
(result.body).should.equal(file.read)
|
||||
end
|
||||
|
||||
it 'should upload profile picture' do
|
||||
file = File.new('../server/files/profile.jpg', 'w+')
|
||||
file.puts('file content')
|
||||
file.close
|
||||
|
||||
request('/staff/edit', {
|
||||
'csrf_userid' => $csrf_userid,
|
||||
'csrf_token' => $csrf_token,
|
||||
'staffId' => $csrf_userid,
|
||||
'file' => File.open( "../server/files/profile.jpg")
|
||||
})
|
||||
|
||||
user = $database.getRow('staff', $csrf_userid)
|
||||
|
||||
result = plainRequest('/system/download', {
|
||||
'csrf_userid' => $csrf_userid,
|
||||
'csrf_token' => $csrf_token,
|
||||
'file' => user['profile_pic']
|
||||
}, 'GET')
|
||||
|
||||
(result.body).should.include('file content')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue