Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chenhao Ma
core
Commits
7e06aab6
Commit
7e06aab6
authored
7 years ago
by
Harsha Kethineni
Committed by
Megan Henning
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
test for #917
parent
f6ce28c4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/integration_tests/python/test_download.py
+35
-0
35 additions, 0 deletions
test/integration_tests/python/test_download.py
with
35 additions
and
0 deletions
test/integration_tests/python/test_download.py
+
35
−
0
View file @
7e06aab6
...
...
@@ -67,6 +67,41 @@ def test_download(data_builder, file_form, as_admin, api_db):
tar
.
close
()
# Download one session with many acquisitions and make sure they are in the same subject folder
acquisition3
=
data_builder
.
create_acquisition
(
session
=
session
)
r
=
as_admin
.
post
(
'
/acquisitions/
'
+
acquisition3
+
'
/files
'
,
files
=
file_form
(
file_name
,
meta
=
{
'
name
'
:
file_name
,
'
type
'
:
'
csv
'
}))
assert
r
.
ok
r
=
as_admin
.
post
(
'
/download
'
,
json
=
{
'
optional
'
:
False
,
'
nodes
'
:
[
{
'
level
'
:
'
acquisition
'
,
'
_id
'
:
acquisition
},
{
'
level
'
:
'
acquisition
'
,
'
_id
'
:
acquisition3
},
]
})
assert
r
.
ok
ticket
=
r
.
json
()[
'
ticket
'
]
# Perform the download
r
=
as_admin
.
get
(
'
/download
'
,
params
=
{
'
ticket
'
:
ticket
})
assert
r
.
ok
tar_file
=
cStringIO
.
StringIO
(
r
.
content
)
tar
=
tarfile
.
open
(
mode
=
"
r
"
,
fileobj
=
tar_file
)
# Verify a single file in tar with correct file name
found_second_session
=
False
for
tarinfo
in
tar
:
assert
os
.
path
.
basename
(
tarinfo
.
name
)
==
file_name
if
'
session1_0
'
in
str
(
tarinfo
.
name
):
found_second_session
=
True
assert
not
found_second_session
tar
.
close
()
# Try to perform the download from a different IP
update_result
=
api_db
.
downloads
.
update_one
(
{
'
_id
'
:
ticket
},
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment