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
4f8aa482
Commit
4f8aa482
authored
8 years ago
by
Megan Henning
Browse files
Options
Downloads
Patches
Plain Diff
Add test for metadata without files
parent
b1824be1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/integration_tests/test_uploads.py
+47
-0
47 additions, 0 deletions
test/integration_tests/test_uploads.py
with
47 additions
and
0 deletions
test/integration_tests/test_uploads.py
+
47
−
0
View file @
4f8aa482
...
...
@@ -329,3 +329,50 @@ def test_acquisition_file_only_engine_upload(with_hierarchy_and_file_data, api_a
for
k
,
v
in
data
.
files
.
items
():
mf
=
find_file_in_array
(
v
[
0
],
a
[
'
files
'
])
assert
mf
is
not
None
def
test_acquisition_metadata_only_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
'
:
'
engine session
'
,
'
subject
'
:
{
'
code
'
:
'
engine subject
'
},
'
metadata
'
:
{
'
test
'
:
'
s
'
}
},
'
acquisition
'
:{
'
label
'
:
'
engine acquisition
'
,
'
timestamp
'
:
'
2016-06-20T21:57:36+00:00
'
,
'
metadata
'
:
{
'
test
'
:
'
a
'
}
}
}
data
.
files
=
{}
data
.
files
[
'
metadata
'
]
=
(
''
,
json
.
dumps
(
metadata
))
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
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
cmp
(
s
[
'
metadata
'
],
metadata
[
'
session
'
][
'
metadata
'
])
==
0
assert
s
[
'
subject
'
][
'
code
'
]
==
metadata
[
'
session
'
][
'
subject
'
][
'
code
'
]
r
=
api_as_admin
.
get
(
'
/acquisitions/
'
+
data
.
acquisition
)
assert
r
.
ok
a
=
json
.
loads
(
r
.
content
)
assert
a
[
'
label
'
]
==
metadata
[
'
acquisition
'
][
'
label
'
]
a_timestamp
=
dateutil
.
parser
.
parse
(
a
[
'
timestamp
'
])
m_timestamp
=
dateutil
.
parser
.
parse
(
metadata
[
'
acquisition
'
][
'
timestamp
'
])
assert
a_timestamp
==
m_timestamp
assert
cmp
(
a
[
'
metadata
'
],
metadata
[
'
acquisition
'
][
'
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