Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.cmdline
Commits
e786ffe1
Commit
e786ffe1
authored
Oct 18, 2019
by
Samuel GAIST
Browse files
[plotters] Port to AssetCommand
parent
264eafdc
Changes
2
Hide whitespace changes
Inline
Side-by-side
beat/cmdline/plotters.py
View file @
e786ffe1
...
...
@@ -56,6 +56,8 @@ from .plotterparameters import pull_impl as plotterparameters_pull
from
.libraries
import
pull_impl
as
libraries_pull
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__
)
...
...
@@ -308,14 +310,17 @@ def plot_impl(
return
0
class
PlotterCommand
(
AssetCommand
):
asset_info
=
AssetInfo
(
asset_type
=
"plotter"
,
diff_fields
=
[
"declaration"
,
"code"
,
"description"
]
)
@
click
.
group
(
cls
=
AliasedGroup
)
@
click
.
pass_context
def
plotters
(
ctx
):
"""Plotters commands"""
ctx
.
meta
[
"asset_type"
]
=
"plotter"
ctx
.
meta
[
"diff_fields"
]
=
[
"declaration"
,
"code"
]
CMD_LIST
=
[
"list"
,
...
...
@@ -330,7 +335,7 @@ CMD_LIST = [
(
"rm"
,
"rm_local"
),
]
commands
.
initialise_asset_commands
(
plotters
,
CMD_LIST
)
commands
.
initialise_asset_commands
(
plotters
,
CMD_LIST
,
PlotterCommand
)
@
plotters
.
command
()
...
...
beat/cmdline/test/test_plotters.py
View file @
e786ffe1
...
...
@@ -56,6 +56,8 @@ class TestOnlinePlotters(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
):
...
...
@@ -68,15 +70,19 @@ class TestOnlinePlotters(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
(
"Plotters don't allow push"
)
@
slow
@
core
.
skip_disconnected
def
test_pull_one_check_deps
(
self
,
obj
=
None
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment