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
beat
beat.cmdline
Commits
de81d861
Commit
de81d861
authored
Oct 15, 2019
by
Samuel GAIST
Browse files
[test][libraries] Add online tests
parent
5f5bf844
Changes
1
Hide whitespace changes
Inline
Side-by-side
beat/cmdline/test/test_libraries.py
View file @
de81d861
...
...
@@ -36,9 +36,14 @@
# Basic tests for the command line beat program: protocoltemplates
import
nose.tools
from
beat.core.test.utils
import
slow
from
beat.core.library
import
Storage
from
.
import
core
from
.
import
tmp_prefix
class
TestLibraryLocal
(
core
.
AssetLocalTest
):
...
...
@@ -51,3 +56,63 @@ class TestLibraryLocal(core.AssetLocalTest):
"new"
:
"user/new_library/2"
,
"fork"
:
"user/forked_library/1"
,
}
class
TestOnlineLibraries
(
core
.
OnlineAssetTestCase
):
asset_type
=
"library"
@
slow
@
core
.
skip_disconnected
def
test_remote_list
(
self
):
exit_code
,
output
=
self
.
call
(
"list"
,
"--remote"
)
nose
.
tools
.
eq_
(
exit_code
,
0
,
output
)
@
slow
@
core
.
skip_disconnected
def
test_pull_one
(
self
):
obj
=
"plot/baselib/1"
exit_code
,
output
=
self
.
call
(
"pull"
,
obj
,
prefix
=
tmp_prefix
)
nose
.
tools
.
eq_
(
exit_code
,
0
,
output
)
s
=
Storage
(
tmp_prefix
,
obj
)
nose
.
tools
.
assert_true
(
s
.
exists
())
@
slow
@
core
.
skip_disconnected
def
test_pull_all
(
self
):
exit_code
,
output
=
self
.
call
(
"pull"
,
prefix
=
tmp_prefix
)
nose
.
tools
.
eq_
(
exit_code
,
0
,
output
)
@
slow
@
core
.
skip_disconnected
def
test_diff
(
self
):
obj
=
"plot/baselib/1"
exit_code
,
output
=
self
.
call
(
"pull"
,
obj
,
prefix
=
tmp_prefix
)
nose
.
tools
.
eq_
(
exit_code
,
0
,
output
)
# quickly modify the user library by emptying it
storage
=
Storage
(
tmp_prefix
,
obj
)
storage
.
code
.
save
(
"class Dummy:
\n
pass"
)
exit_code
,
output
=
self
.
call
(
"diff"
,
obj
,
prefix
=
tmp_prefix
)
nose
.
tools
.
eq_
(
exit_code
,
0
,
output
)
@
slow
@
core
.
skip_disconnected
def
test_status
(
self
):
self
.
test_diff
()
self
.
test_pull_one
()
exit_code
,
output
=
self
.
call
(
"status"
,
prefix
=
tmp_prefix
)
nose
.
tools
.
eq_
(
exit_code
,
0
,
output
)
@
slow
@
core
.
skip_disconnected
def
test_push_and_delete
(
self
):
obj
=
"user/newobject/1"
TestLibraryLocal
.
create
(
obj
)
# now push the new object and then delete it remotely
exit_code
,
output
=
self
.
call
(
"push"
,
obj
,
prefix
=
tmp_prefix
)
nose
.
tools
.
eq_
(
exit_code
,
0
,
output
)
exit_code
,
output
=
self
.
call
(
"rm"
,
"--remote"
,
obj
,
prefix
=
tmp_prefix
)
nose
.
tools
.
eq_
(
exit_code
,
0
,
output
)
Write
Preview
Supports
Markdown
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