Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
14329873
Commit
14329873
authored
Feb 27, 2020
by
Markus Scheidgen
Browse files
Merge branch 'v0.7.10' into v0.8.0<
parents
2b83f245
22b09bb2
Changes
63
Hide whitespace changes
Inline
Side-by-side
tests/test_cli.py
View file @
14329873
...
...
@@ -17,12 +17,14 @@ import pytest
import
click.testing
import
json
import
mongoengine
import
datetime
from
nomad
import
utils
,
search
,
processing
as
proc
,
files
,
infrastructure
from
nomad.cli
import
cli
from
nomad.processing
import
Upload
,
Calc
from
tests.app.test_app
import
BlueprintClient
from
tests.utils
import
assert_exception
# TODO there is much more to test
...
...
@@ -68,6 +70,32 @@ class TestAdmin:
assert
Calc
.
objects
(
upload_id
=
upload_id
).
first
()
is
None
assert
search
.
SearchRequest
().
search_parameter
(
'upload_id'
,
upload_id
).
execute
()[
'total'
]
>
0
@
pytest
.
mark
.
parametrize
(
'upload_time,dry,lifted'
,
[
(
datetime
.
datetime
.
now
(),
False
,
False
),
(
datetime
.
datetime
(
year
=
2012
,
month
=
1
,
day
=
1
),
True
,
False
),
(
datetime
.
datetime
(
year
=
2012
,
month
=
1
,
day
=
1
),
False
,
True
)])
def
test_lift_embargo
(
self
,
published
,
upload_time
,
dry
,
lifted
):
upload_id
=
published
.
upload_id
published
.
upload_time
=
upload_time
published
.
save
()
calc
=
Calc
.
objects
(
upload_id
=
upload_id
).
first
()
assert
published
.
upload_files
.
exists
()
assert
calc
.
metadata
[
'with_embargo'
]
assert
search
.
SearchRequest
().
owner
(
'public'
).
search_parameter
(
'upload_id'
,
upload_id
).
execute
()[
'total'
]
==
0
with
assert_exception
():
files
.
UploadFiles
.
get
(
upload_id
=
upload_id
).
archive_file
(
calc_id
=
calc
.
calc_id
)
result
=
click
.
testing
.
CliRunner
().
invoke
(
cli
,
[
'admin'
,
'lift-embargo'
]
+
([
'--dry'
]
if
dry
else
[]),
catch_exceptions
=
False
,
obj
=
utils
.
POPO
())
assert
result
.
exit_code
==
0
assert
not
Calc
.
objects
(
upload_id
=
upload_id
).
first
().
metadata
[
'with_embargo'
]
==
lifted
assert
(
search
.
SearchRequest
().
owner
(
'public'
).
search_parameter
(
'upload_id'
,
upload_id
).
execute
()[
'total'
]
>
0
)
==
lifted
if
lifted
:
assert
files
.
UploadFiles
.
get
(
upload_id
=
upload_id
).
archive_file
(
calc_id
=
calc
.
calc_id
)
def
test_index
(
self
,
published
):
upload_id
=
published
.
upload_id
calc
=
Calc
.
objects
(
upload_id
=
upload_id
).
first
()
...
...
@@ -123,6 +151,15 @@ class TestAdminUploads:
assert
result
.
exit_code
==
0
assert
'1 uploads selected'
in
result
.
stdout
def
test_ls_query
(
self
,
published
):
upload_id
=
published
.
upload_id
result
=
click
.
testing
.
CliRunner
().
invoke
(
cli
,
[
'admin'
,
'uploads'
,
'ls'
,
'{"match":{"upload_id":"%s"}}'
%
upload_id
],
catch_exceptions
=
False
,
obj
=
utils
.
POPO
())
assert
result
.
exit_code
==
0
assert
'1 uploads selected'
in
result
.
stdout
def
test_rm
(
self
,
published
):
upload_id
=
published
.
upload_id
...
...
tests/test_config.py
View file @
14329873
...
...
@@ -19,11 +19,11 @@ from nomad import config
@
pytest
.
fixture
def
with_config
():
old_value
=
config
.
fs
.
migration_packages
old_value
=
config
.
fs
.
public
yield
config
config
.
fs
.
migration_packages
=
old_value
config
.
fs
.
public
=
old_value
def
test_apply
(
with_config
):
config
.
apply
(
'fs_
migration_packages
'
,
'test_value'
)
assert
config
.
fs
.
migration_packages
==
'test_value'
config
.
apply
(
'fs_
public
'
,
'test_value'
)
assert
config
.
fs
.
public
==
'test_value'
tests/test_normalizing.py
View file @
14329873
...
...
@@ -67,7 +67,7 @@ parser_exceptions = {
'parsers/phonopy'
:
[
'basis_set'
,
'xc_functional'
],
'parsers/gpaw2'
:
symmetry_keys
,
'parsers/gamess'
:
[
'formula'
,
'system'
]
+
symmetry_keys
,
'parsers/gulp'
:
[
'formula'
,
'xc_functional'
,
'system'
]
+
symmetry_keys
,
'parsers/gulp'
:
[
'formula'
,
'xc_functional'
,
'system'
,
'basis_set'
]
+
symmetry_keys
,
'parsers/turbomole'
:
symmetry_keys
,
'parsers/elastic'
:
[
'basis_set'
,
'xc_functional'
,
'system'
]
+
symmetry_keys
,
'parsers/dmol'
:
[
'system'
]
+
symmetry_keys
,
...
...
Prev
1
2
3
4
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment