From db63948db700e5fd6a257d3afc663b5617cee49c Mon Sep 17 00:00:00 2001 From: Ivan Diaz Date: Fri, 13 Jan 2017 14:40:21 -0300 Subject: [PATCH] Ivan - Add file upload test [skip ci] --- tests/system/fiile-upload-download.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/system/fiile-upload-download.rb diff --git a/tests/system/fiile-upload-download.rb b/tests/system/fiile-upload-download.rb new file mode 100644 index 00000000..ebaa8345 --- /dev/null +++ b/tests/system/fiile-upload-download.rb @@ -0,0 +1,24 @@ +describe 'File Upload and Download' do + request('/user/logout') + Scripts.login("creator@os4.com", "creator") + + it 'should upload file when creating ticket' do + file = File.new('upload.txt', 'w') + file.puts('file content') + + result = request('/ticket/create', { + 'csrf_userid' => $csrf_userid, + 'csrf_token' => $csrf_token, + 'title' => 'Ticket with file', + 'content' => 'this is a ticket that contains a file', + 'language' => 'en', + 'file' => file + }) + (result['status']).should.equal('success'); + + ticket = $database.getLastRow('ticket'); + + (ticket['file'].include? 'upload.txt').should.equal(true) + (File.exist?('../server/files' + ticket['file'])).should.equal(true) + end +end