Commit 6103410d authored by Samuel GAIST's avatar Samuel GAIST

[test][experiments] Use AssetLocalTest for local only tests

parent 2b25ea13
......@@ -50,8 +50,6 @@ from beat.core.algorithm import Storage as AlgStorage
from beat.core.dataformat import Storage as DFStorage
from beat.core.database import Storage as DBStorage
from ..common import Selector
from .utils import index_experiment_dbs, MockLoggingHandler
from . import core
......@@ -63,6 +61,28 @@ def setup_experiments():
index_experiment_dbs("user/user/integers_addition/1/integers_addition")
class TestLocal(core.AssetLocalTest):
storage_cls = Storage
asset_type = "experiment"
object_map = {
"valid": "user/user/single/1/single",
"invalid": "user/user/single/1/does_not_exist",
"create": "user/user/single/1/single",
"fork": "user/user/unknown/1/forked_obj",
}
@classmethod
def create(cls, obj=None):
"""Can't create from scratch so copy an object of the tests"""
src_storage = cls.storage_cls(prefix, obj)
dst_storage = cls.storage_cls(tmp_prefix, obj)
dst_storage.save(*src_storage.load())
def test_create(self, obj=None):
nose.SkipTest("Experiment can't be created")
class TestOnline(core.OnlineAssetTestCase):
asset_type = "experiment"
......@@ -100,29 +120,6 @@ class TestOnline(core.OnlineAssetTestCase):
dst_storage = storage_cls(tmp_prefix, asset)
dst_storage.save(*src_storage.load())
@core.skip_disconnected
def test_fork(self, obj=None, obj2=None):
obj = obj or "user/user/single/1/single"
self.test_pull_one(obj)
obj2 = obj2 or "user/user/single/1/different"
exit_code, outputs = self.call("fork", obj, obj2, prefix=tmp_prefix)
nose.tools.eq_(exit_code, 0, outputs)
s = Storage(tmp_prefix, obj2)
nose.tools.assert_true(s.exists())
# check fork status
with Selector(tmp_prefix) as selector:
nose.tools.eq_(selector.forked_from("experiment", obj2), obj)
@core.skip_disconnected
def test_delete_local(self):
obj = "user/user/single/1/single"
storage = self.test_pull_one(obj)
exit_code, outputs = self.call("rm", obj, prefix=tmp_prefix)
nose.tools.eq_(exit_code, 0, outputs)
nose.tools.assert_false(storage.exists())
@core.skip_disconnected
def test_draw(self):
obj = "user/user/double_triangle/1/double_triangle"
......@@ -170,20 +167,6 @@ class TestOnline(core.OnlineAssetTestCase):
nose.tools.eq_(exit_code, 0, outputs)
class TestValidity(core.AssetBaseTest):
asset_type = "experiment"
def test_check_valid(self):
obj = "user/user/single/1/single"
exit_code, outputs = self.call("check", obj)
nose.tools.eq_(exit_code, 0, outputs)
def test_check_invalid(self):
obj = "user/user/single/1/does_not_exist"
exit_code, outputs = self.call("check", obj)
nose.tools.eq_(exit_code, 1, outputs)
class TestCache(core.AssetBaseTest):
asset_type = "experiment"
......
Markdown is supported
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