Skip to content

Commit

Permalink
Merge 699e6b6 into 0c2c835
Browse files Browse the repository at this point in the history
  • Loading branch information
atruskie committed Mar 21, 2016
2 parents 0c2c835 + 699e6b6 commit ece0a20
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/controllers/analysis_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def file_info(path)
path: normalised_path,
name: normalised_name,
type: 'file',
size: File.size(path),
size_bytes: File.size(path),
mime: Mime::Type.lookup_by_extension(File.extname(path)[1..-1]).to_s
}
end
Expand Down Expand Up @@ -292,4 +292,4 @@ def return_dir(request_info)
end


end
end
37 changes: 30 additions & 7 deletions spec/acceptance/analysis_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@ def create_dir(dir = File.join('Test1', 'Test2'))
'{"path":"TopDir/one/two","name":"two","type":"directory","children":[',
'{"path":"TopDir/one/two/three","name":"three","type":"directory","children":[',
'{"path":"TopDir/one/two/three/four","name":"four","type":"directory","children":[',
'{"path":"TopDir/one/two/three/four/five.txt","name":"five.txt","size":14,"type":"file","mime":"text/plain"}',
'{"path":"TopDir/one/two/three/four/five.txt","name":"five.txt","size_bytes":14,"type":"file","mime":"text/plain"}',
'{"path":"TopDir/one/two/three/four/five","name":"five","type":"directory","children":[',
'{"path":"TopDir/one/two/three/four/five/six.txt","name":"six.txt","size":13,"type":"file","mime":"text/plain"}',
'{"path":"TopDir/one/two/three/four/five/six.txt","name":"six.txt","size_bytes":13,"type":"file","mime":"text/plain"}',
'{"path":"TopDir/one3","name":"one3","type":"directory","children":[]}',
'{"path":"TopDir/one1","name":"one1","type":"directory","children":[]}',
'{"path":"TopDir/one2","name":"one2","type":"directory","children":[]}',
Expand Down Expand Up @@ -323,9 +323,9 @@ def create_dir(dir = File.join('Test1', 'Test2'))
'{"path":"TopDir/one/two","name":"two","type":"directory","children":[',
'{"path":"TopDir/one/two/three","name":"three","type":"directory","children":[',
'{"path":"TopDir/one/two/three/four","name":"four","type":"directory","children":[',
'{"path":"TopDir/one/two/three/four/five.txt","name":"five.txt","size":14,"type":"file","mime":"text/plain"}',
'{"path":"TopDir/one/two/three/four/five.txt","name":"five.txt","size_bytes":14,"type":"file","mime":"text/plain"}',
'{"path":"TopDir/one/two/three/four/five","name":"five","type":"directory","children":[',
'{"path":"TopDir/one/two/three/four/five/six.txt","name":"six.txt","size":13,"type":"file","mime":"text/plain"}',
'{"path":"TopDir/one/two/three/four/five/six.txt","name":"six.txt","size_bytes":13,"type":"file","mime":"text/plain"}',
'{"path":"TopDir/one3","name":"one3","type":"directory","children":[]}',
'{"path":"TopDir/one1","name":"one1","type":"directory","children":[]}',
'{"path":"TopDir/one2","name":"one2","type":"directory","children":[]}',
Expand Down Expand Up @@ -354,9 +354,32 @@ def create_dir(dir = File.join('Test1', 'Test2'))
'{"path":"TopDir/one/two","name":"two","type":"directory","children":[',
'{"path":"TopDir/one/two/three","name":"three","type":"directory","children":[',
'{"path":"TopDir/one/two/three/four","name":"four","type":"directory","children":[',
'{"path":"TopDir/one/two/three/four/five.txt","name":"five.txt","size":14,"type":"file","mime":"text/plain"}',
'{"path":"TopDir/one/two/three/four/five.txt","name":"five.txt","size_bytes":14,"type":"file","mime":"text/plain"}',
'{"path":"TopDir/one/two/three/four/five","name":"five","type":"directory","children":[',
'{"path":"TopDir/one/two/three/four/five/six.txt","name":"six.txt","size":13,"type":"file","mime":"text/plain"}'
'{"path":"TopDir/one/two/three/four/five/six.txt","name":"six.txt","size_bytes":13,"type":"file","mime":"text/plain"}'
]
})
end
get test_url do
standard_analysis_parameters
let(:authentication_token) { admin_token }
let(:results_path) { 'TopDir/one/two/three/four' }

standard_request_options(
:get,
'ANALYSIS (as admin, requesting sub sub dir with files)',
:ok,
{
response_body_content: [
'{"meta":{"status":200,"message":"OK"},"data":',
'{"path":"TopDir/one/two/three/four","name":"four","type":"directory","children":[',
'{"path":"TopDir/one/two/three/four/five.txt","name":"five.txt","type":"file","size_bytes":14,"mime":"text/plain"}',
'{"path":"TopDir/one/two/three/four/five","name":"five","type":"directory","has_children":true}'
],
invalid_data_content: [
'{"path":"TopDir/one/two","name":"two","type":"directory","children":[',
'{"path":"TopDir/one/two/three","name":"three","type":"directory","children":[',
'{"path":"TopDir/one/two/three/four/five/six.txt","name":"six.txt","size_bytes":13,"type":"file","mime":"text/plain"}'
]
})
end
Expand All @@ -383,7 +406,7 @@ def create_dir(dir = File.join('Test1', 'Test2'))
'{"path":"/","name":"/","type":"directory","children":['
],
invalid_data_content: [
'{"path":".test-dot-file","name":".test-dot-file","type":"file","size":0,"mime":""}'
'{"path":".test-dot-file","name":".test-dot-file","type":"file","size_bytes":0,"mime":""}'
]
})
end
Expand Down

0 comments on commit ece0a20

Please sign in to comment.