Commit 272c41a3 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[test][core] Refactored handling of call and create

This allows for other tests to re-use these class methods
parent d35ed362
......@@ -62,13 +62,14 @@ class AssetLocalTest:
def teardown(self):
cleanup()
def call(self, *args, **kwargs):
@classmethod
def call(cls, *args, **kwargs):
"""A central mechanism to call the main routine with the right parameters"""
use_prefix = kwargs.get("prefix", prefix)
use_platform = kwargs.get("platform", platform)
use_cache = kwargs.get("cache", "cache")
asset_type = kwargs.get("asset_type", self.asset_type)
asset_type = kwargs.get("asset_type", cls.asset_type)
runner = CliRunner()
with runner.isolated_filesystem():
......@@ -108,14 +109,18 @@ class AssetLocalTest:
exit_code, outputs = self.call("check", self.object_map["invalid"])
nose.tools.eq_(exit_code, 1, outputs)
def test_create(self, obj=None):
obj = obj or self.object_map["create"]
exit_code, outputs = self.call("create", obj, prefix=tmp_prefix)
@classmethod
def create(cls, obj=None):
obj = obj or cls.object_map["create"]
exit_code, outputs = cls.call("create", obj, prefix=tmp_prefix)
nose.tools.eq_(exit_code, 0, outputs)
s = self.storage_cls(tmp_prefix, obj)
s = cls.storage_cls(tmp_prefix, obj)
nose.tools.assert_true(s.exists())
return s
def test_create(self, obj=None):
self.create(self.object_map["create"])
def test_new_version(self):
obj = self.object_map["create"]
obj2 = self.object_map["new"]
......@@ -144,7 +149,7 @@ class AssetLocalTest:
def test_delete_local(self):
obj = self.object_map["create"]
storage = self.test_create(obj)
storage = self.create(obj)
exit_code, outputs = self.call("rm", obj, prefix=tmp_prefix)
nose.tools.eq_(exit_code, 0, outputs)
nose.tools.assert_false(storage.exists())
......
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