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
882ca9cb
Commit
882ca9cb
authored
8 years ago
by
Megan Henning
Browse files
Options
Downloads
Patches
Plain Diff
Add engine acquisition test
parent
a45223c6
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/test_uploads.py
+56
-14
56 additions, 14 deletions
test/integration_tests/test_uploads.py
with
56 additions
and
14 deletions
test/integration_tests/test_uploads.py
+
56
−
14
View file @
882ca9cb
...
...
@@ -43,7 +43,7 @@ def with_group_and_file_data(api_as_admin, data_builder, bunch, request):
return
fixture_data
@pytest.fixture
()
def
with_hierarchyand_file_data
(
api_as_admin
,
bunch
,
request
,
data_builder
):
def
with_hierarchy
_
and_file_data
(
api_as_admin
,
bunch
,
request
,
data_builder
):
group
=
data_builder
.
create_group
(
'
test_upload_
'
+
str
(
int
(
time
.
time
()
*
1000
)))
project
=
data_builder
.
create_project
(
group
)
session
=
data_builder
.
create_session
(
project
)
...
...
@@ -151,29 +151,71 @@ def test_label_upload(with_group_and_file_data, api_as_admin):
r
=
api_as_admin
.
post
(
'
/upload/label
'
,
files
=
data
.
files
)
assert
r
.
status_code
==
400
def
test_acquisition_engine_upload
(
with_hierarchyand_file_data
,
api_as_admin
):
data
=
with_group_and_file_data
def
find_file_in_array
(
filename
,
files
):
for
f
in
files
:
if
f
.
get
(
'
name
'
)
==
filename
:
return
f
def
test_acquisition_engine_upload
(
with_hierarchy_and_file_data
,
api_as_admin
):
data
=
with_hierarchy_and_file_data
metadata
=
{
'
project
'
:{
'
label
'
:
'
engine project
'
,
'
metadata
'
:
{
'
test
'
:
'
p
'
}
},
'
session
'
:{
'
label
'
:
'
test_session
'
,
'
files
'
:[
{
'
name
'
:
data
.
files
.
keys
()[
1
]
}
],
'
subject
'
:
{
'
code
'
:
'
test_subject
'
}
'
label
'
:
'
engine session
'
,
'
subject
'
:
{
'
code
'
:
'
engine subject
'
},
'
metadata
'
:
{
'
test
'
:
'
s
'
}
},
'
acquisition
'
:{
'
label
'
:
'
test_acquisition
'
,
'
label
'
:
'
engine acquisition
'
,
'
timestamp
'
:
'
2016-06-20T21:57:36.636808+00:00
'
'
metadata
'
:
{
'
test
'
:
'
a
'
}
'
files
'
:[
{
'
name
'
:
data
.
files
.
keys
()[
2
]
'
name
'
:
data
.
files
.
keys
()[
0
],
'
type
'
:
'
engine type 0
'
,
'
metadata
'
:
{
'
test
'
:
'
f0
'
}
},
{
'
name
'
:
data
.
files
.
keys
()[
1
],
'
type
'
:
'
engine type 1
'
,
'
metadata
'
:
{
'
test
'
:
'
f1
'
}
}
]
}
}
metadata
=
json
.
dumps
(
metadata
)
data
.
files
[
'
metadata
'
]
=
json
.
dumps
(
metadata
)
r
=
api_as_admin
.
post
(
'
/
upload/label
'
,
files
=
data
.
files
)
r
=
api_as_admin
.
post
(
'
/
engine?level=acquisition&id=data.acquisition
'
,
files
=
data
.
files
)
assert
r
.
ok
r
=
api_as_admin
.
get
(
'
/projects/
'
+
data
.
project
)
assert
r
.
ok
p
=
json
.
loads
(
r
.
content
)
assert
p
[
'
label
'
]
==
metadata
[
'
project
'
][
'
label
'
]
assert
p
[
'
timestamp
'
]
==
metadata
[
'
acquisition
'
][
'
timestamp
'
]
assert
cmp
(
p
[
'
metadata
'
],
metadata
[
'
project
'
][
'
metadata
'
])
==
0
r
=
api_as_admin
.
get
(
'
/sessions/
'
+
data
.
session
)
assert
r
.
ok
s
=
json
.
loads
(
r
.
content
)
assert
s
[
'
label
'
]
==
metadata
[
'
session
'
][
'
label
'
]
assert
s
[
'
timestamp
'
]
==
metadata
[
'
acquisition
'
][
'
timestamp
'
]
assert
cmp
(
s
[
'
metadata
'
],
metadata
[
'
session
'
][
'
metadata
'
])
==
0
assert
cmp
(
s
[
'
subject
'
],
metadata
[
'
session
'
][
'
subject
'
])
==
0
r
=
api_as_admin
.
get
(
'
/acquisitions/
'
+
data
.
acquisition
)
assert
r
.
ok
a
=
json
.
loads
(
r
.
content
)
assert
a
[
'
label
'
]
==
metadata
[
'
session
'
][
'
label
'
]
assert
a
[
'
timestamp
'
]
==
metadata
[
'
acquisition
'
][
'
timestamp
'
]
assert
cmp
(
a
[
'
metadata
'
],
metadata
[
'
session
'
][
'
metadata
'
])
==
0
for
f
in
a
[
'
files
'
]:
mf
=
find_file_in_array
(
f
[
'
name
'
],
metadata
)
assert
mf
is
not
None
assert
f
[
'
type
'
]
==
mf
[
'
type
'
]
assert
cmp
(
f
[
'
metadata
'
],
mf
[
'
metadata
'
])
==
0
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