Commit 4aa391e2 authored by Samuel GAIST's avatar Samuel GAIST

[test][algorithms] Add fork test setup

parent e37e8026
......@@ -39,10 +39,12 @@
import nose.tools
from beat.core.algorithm import Storage
from beat.core.algorithm import Algorithm
from beat.core.dataformat import Storage as DFStorage
from beat.core.library import Storage as LibStorage
from . import core
from . import tmp_prefix
from . import tmp_prefix, prefix
class TestOnlineAlgorithms(core.OnlineAssetTestCase):
......@@ -53,6 +55,8 @@ class TestOnlineAlgorithms(core.OnlineAssetTestCase):
"pull": "user/integers_add/1",
"diff": "user/integers_add/1",
"create": "user/newobject/1",
"fork_from": "user/unknown/1",
"fork": "user/forked_obj/1",
"push": "user/db_input_loop_processor/1",
"not_owner_push": "v1/integers_add/1",
}
......@@ -63,6 +67,22 @@ class TestOnlineAlgorithms(core.OnlineAssetTestCase):
storage = self.storage_cls(tmp_prefix, asset_name)
storage.code.save("class Algorithm:\n pass")
def _prepare_fork_dependencies(self, asset_name):
super()._prepare_fork_dependencies(asset_name)
algorithm = Algorithm(prefix, asset_name)
for lib in algorithm.libraries.keys():
src_storage = LibStorage(prefix, lib)
dst_storage = LibStorage(tmp_prefix, lib)
dst_storage.save(*src_storage.load())
for dataformat in algorithm.dataformats.keys():
if dataformat.startswith("user"):
src_storage = DFStorage(prefix, dataformat)
dst_storage = DFStorage(tmp_prefix, dataformat)
dst_storage.save(*src_storage.load())
class TestAlgorithmLocal(core.AssetLocalTest):
storage_cls = Storage
......
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