From e44792c3de5cb723bfe4cf14176e9f02d837674b Mon Sep 17 00:00:00 2001 From: AntonyAntonio Date: Mon, 16 Jan 2017 20:06:08 -0300 Subject: [PATCH] Ivan - Add csv file [skip ci] --- tests/system/csv-import.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/system/csv-import.rb diff --git a/tests/system/csv-import.rb b/tests/system/csv-import.rb new file mode 100644 index 00000000..61ac34ba --- /dev/null +++ b/tests/system/csv-import.rb @@ -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