Ivan - Add csv file [skip ci]

This commit is contained in:
AntonyAntonio 2017-01-16 20:06:08 -03:00
parent c4b63aab43
commit e44792c3de
1 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,28 @@
describe'system/csv-import' do
request('/user/logout')
Scripts.login($staff[:email], $staff[:password], true)
it 'should create user with csv-import' do
file = File.new('../server/files/test.csv', 'w+')
file.puts('prueba1@hotmail.com, contrasena1,ma')
file.puts('prueba2@hotmail.com,contrasena2,max')
file.puts('prueba3@hotmail.com,contrasena3,maxi')
file.close
result= request('/system/csv-import', {
csrf_userid: $csrf_userid,
csrf_token: $csrf_token,
file: File.open( "../server/files/test.csv")
})
(result['status']).should.equal('success')
row = $database.getRow('user', 'prueba1@hotmail.com', 'email')
(row['name']).should.equal('ma')
row = $database.getRow('user', 'prueba2@hotmail.com', 'email')
(row['name']).should.equal('max')
row = $database.getRow('user', 'prueba3@hotmail.com', 'email')
(row['name']).should.equal('maxi')
end
end