mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-28 08:14:25 +02:00
Ivan - Add file upload test [skip ci]
This commit is contained in:
parent
71984384cc
commit
db63948db7
24
tests/system/fiile-upload-download.rb
Normal file
24
tests/system/fiile-upload-download.rb
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user