Commit 2423e854 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[test] Refactor tests for centralized push and delete test

parent 1f76e259
...@@ -50,7 +50,11 @@ class TestOnlinAlgorithms(core.OnlineAssetTestCase): ...@@ -50,7 +50,11 @@ class TestOnlinAlgorithms(core.OnlineAssetTestCase):
asset_type = "algorithm" asset_type = "algorithm"
storage_cls = Storage storage_cls = Storage
object_map = {"pull": "user/integers_add/1", "diff": "user/integers_add/1"} object_map = {
"pull": "user/integers_add/1",
"diff": "user/integers_add/1",
"create": "user/newobject/1",
}
def _modify_asset(self, asset_name): def _modify_asset(self, asset_name):
"""Re-imp""" """Re-imp"""
...@@ -77,14 +81,7 @@ class TestOnlinAlgorithms(core.OnlineAssetTestCase): ...@@ -77,14 +81,7 @@ class TestOnlinAlgorithms(core.OnlineAssetTestCase):
@core.skip_disconnected @core.skip_disconnected
def test_push_and_delete(self): def test_push_and_delete(self):
self.create_dataformat() self.create_dataformat()
obj = "user/newobject/1" super().test_push_and_delete()
TestAlgorithmLocal.create(obj)
# now push the new object and then delete it remotely
exit_code, outputs = self.call("push", obj, prefix=tmp_prefix)
nose.tools.eq_(exit_code, 0, outputs)
exit_code, outputs = self.call("rm", "--remote", obj, prefix=tmp_prefix)
nose.tools.eq_(exit_code, 0, outputs)
class TestAlgorithmLocal(core.AssetLocalTest): class TestAlgorithmLocal(core.AssetLocalTest):
......
...@@ -36,9 +36,6 @@ ...@@ -36,9 +36,6 @@
# Basic tests for the command line beat program: dataformats # Basic tests for the command line beat program: dataformats
import nose.tools
from beat.core.test.utils import slow
from beat.core.dataformat import Storage, DataFormat from beat.core.dataformat import Storage, DataFormat
from . import core from . import core
...@@ -49,7 +46,11 @@ class TestOnlineDataformats(core.OnlineAssetTestCase): ...@@ -49,7 +46,11 @@ class TestOnlineDataformats(core.OnlineAssetTestCase):
asset_type = "dataformat" asset_type = "dataformat"
storage_cls = Storage storage_cls = Storage
object_map = {"pull": "system/bounding_box_video/1", "diff": "system/integer/1"} object_map = {
"pull": "system/bounding_box_video/1",
"diff": "system/integer/1",
"create": "user/newobject/1",
}
def _modify_asset(self, asset_name): def _modify_asset(self, asset_name):
"""Re-imp""" """Re-imp"""
...@@ -58,18 +59,6 @@ class TestOnlineDataformats(core.OnlineAssetTestCase): ...@@ -58,18 +59,6 @@ class TestOnlineDataformats(core.OnlineAssetTestCase):
dataformat.data["value"] = "int64" dataformat.data["value"] = "int64"
dataformat.write() dataformat.write()
@slow
@core.skip_disconnected
def test_push_and_delete(self):
obj = "user/newobject/1"
TestDataFormatLocal.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)
class TestDataFormatLocal(core.AssetLocalTest): class TestDataFormatLocal(core.AssetLocalTest):
storage_cls = Storage storage_cls = Storage
......
...@@ -36,10 +36,6 @@ ...@@ -36,10 +36,6 @@
# Basic tests for the command line beat program: protocoltemplates # 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 beat.core.library import Storage
from . import core from . import core
...@@ -62,22 +58,14 @@ class TestOnlineLibraries(core.OnlineAssetTestCase): ...@@ -62,22 +58,14 @@ class TestOnlineLibraries(core.OnlineAssetTestCase):
asset_type = "library" asset_type = "library"
storage_cls = Storage storage_cls = Storage
object_map = {"pull": "plot/baselib/1", "diff": "plot/baselib/1"} object_map = {
"pull": "plot/baselib/1",
"diff": "plot/baselib/1",
"create": "user/newobject/1",
}
def _modify_asset(self, asset_name): def _modify_asset(self, asset_name):
"""Re-imp""" """Re-imp"""
storage = self.storage_cls(tmp_prefix, asset_name) storage = self.storage_cls(tmp_prefix, asset_name)
storage.code.save("class Dummy:\n pass") storage.code.save("class Dummy:\n pass")
@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)
...@@ -49,7 +49,11 @@ class TestOnlineToolchains(core.OnlineAssetTestCase): ...@@ -49,7 +49,11 @@ class TestOnlineToolchains(core.OnlineAssetTestCase):
asset_type = "toolchain" asset_type = "toolchain"
storage_cls = Storage storage_cls = Storage
object_map = {"pull": "user/single/1", "diff": "user/single/1"} object_map = {
"pull": "user/single/1",
"diff": "user/single/1",
"create": "user/newobject/1",
}
def _modify_asset(self, asset_name): def _modify_asset(self, asset_name):
"""Re-imp""" """Re-imp"""
...@@ -58,17 +62,6 @@ class TestOnlineToolchains(core.OnlineAssetTestCase): ...@@ -58,17 +62,6 @@ class TestOnlineToolchains(core.OnlineAssetTestCase):
toolchains.data["representation"]["blocks"]["echo"]["height"] = 2 toolchains.data["representation"]["blocks"]["echo"]["height"] = 2
toolchains.write() toolchains.write()
@core.skip_disconnected
def test_push_and_delete(self):
obj = "user/newobject/1"
TestToolchainLocal.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)
@core.skip_disconnected @core.skip_disconnected
def test_draw(self): def test_draw(self):
obj = "user/double_triangle/1" obj = "user/double_triangle/1"
......
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