Commit de81d861 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[test][libraries] Add online tests

parent 5f5bf844
......@@ -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)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment