Commit 264eafdc authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[plotterparameters] Port to AssetCommand

parent 1c7e3b26
......@@ -42,6 +42,8 @@ from . import commands
from .decorators import raise_on_error
from .click_helper import AliasedGroup
from .click_helper import AssetCommand
from .click_helper import AssetInfo
logger = logging.getLogger(__name__)
......@@ -93,14 +95,15 @@ def pull_impl(webapi, prefix, names, force, indentation, format_cache):
return status
class PlotterparametersCommand(AssetCommand):
asset_info = AssetInfo(asset_type="plotterparameter", diff_fields=["data"])
@click.group(cls=AliasedGroup)
@click.pass_context
def plotterparameters(ctx):
"""Plotterparameters commands"""
ctx.meta["asset_type"] = "plotterparameter"
ctx.meta["diff_fields"] = ["data"]
CMD_LIST = [
"list",
......@@ -115,7 +118,9 @@ CMD_LIST = [
("rm", "rm_local"),
]
commands.initialise_asset_commands(plotterparameters, CMD_LIST)
commands.initialise_asset_commands(
plotterparameters, CMD_LIST, PlotterparametersCommand
)
@plotterparameters.command()
......
......@@ -54,6 +54,8 @@ class TestOnlinePlotterParameters(core.OnlineAssetTestCase):
"pull": "plot/bar/1",
"diff": "plot/bar/1",
"create": "user/newobject/1",
"push": "plot/bar/1",
"not_owner_push": "plot/bar/1",
}
def _modify_asset(self, asset_name):
......@@ -66,15 +68,20 @@ class TestOnlinePlotterParameters(core.OnlineAssetTestCase):
@slow
@core.skip_disconnected
def test_push_and_delete(self):
asset_name = self.object_map["create"]
self.create(asset_name)
asset_name = self.object_map["push"]
# now push the new object and then delete it remotely
exit_code, output = self.call("push", asset_name, prefix=tmp_prefix)
exit_code, output = self.call("push", asset_name)
nose.tools.eq_(exit_code, 2, output)
exit_code, output = self.call("rm", "--remote", asset_name, prefix=tmp_prefix)
exit_code, output = self.call("rm", "--remote", asset_name)
nose.tools.eq_(exit_code, 2, output)
@core.skip_disconnected
def test_fail_not_owner_push(self):
"""No owner so not need to test"""
raise nose.SkipTest("Plotterparameters don't allow push")
class TestPlotterparameterLocal(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