tests
This commit is contained in:
parent
ea061db51f
commit
d16a761241
7
test_cli.py
Normal file
7
test_cli.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
from shlax.cli import ConsoleScript
|
||||||
|
|
||||||
|
|
||||||
|
def test_parser():
|
||||||
|
parser = ConsoleScript.Parser(['@host'])
|
||||||
|
parser.parse()
|
||||||
|
assert parser.targets['host'] == Ssh('host')
|
||||||
7
tests/test_cli.py
Normal file
7
tests/test_cli.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
from shlax.cli import ConsoleScript
|
||||||
|
|
||||||
|
|
||||||
|
def test_parser():
|
||||||
|
parser = ConsoleScript.Parser(['@host'])
|
||||||
|
parser.parse()
|
||||||
|
assert parser.targets['host'] == Ssh('host')
|
||||||
5
tests/test_play.py
Normal file
5
tests/test_play.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
from shlax.play import Play
|
||||||
|
|
||||||
|
|
||||||
|
def test_play_call():
|
||||||
|
|
||||||
47
tests/test_shlax.py
Normal file
47
tests/test_shlax.py
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
import copy
|
||||||
|
|
||||||
|
|
||||||
|
class Action:
|
||||||
|
args = dict(
|
||||||
|
step=None,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class
|
||||||
|
user=dict(
|
||||||
|
doc='Username',
|
||||||
|
required=True,
|
||||||
|
),
|
||||||
|
steps=dict(
|
||||||
|
up='Started',
|
||||||
|
down='Stopped',
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
self.args = args
|
||||||
|
self.kwargs = kwargs
|
||||||
|
|
||||||
|
def __call__(self, *args, **kwargs):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class Target(Action):
|
||||||
|
def __call__(self, action):
|
||||||
|
action = copy.deepcopy(action)
|
||||||
|
action.target = self
|
||||||
|
|
||||||
|
|
||||||
|
class FakeAction(Action):
|
||||||
|
|
||||||
|
|
||||||
|
def __init__(self, user, path, *steps, **kwargs)
|
||||||
|
self.user = user
|
||||||
|
self.path = path
|
||||||
|
self.steps = steps
|
||||||
|
self.kwargs = kwargs
|
||||||
|
|
||||||
|
|
||||||
|
action = Action('root', '/test', 'up', 'rm')
|
||||||
|
target = Target()
|
||||||
6
tests/test_ssh.py
Normal file
6
tests/test_ssh.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
if not os.getenv('CI'):
|
||||||
|
pytest.skip('Please run with ./shlaxfile.py test', allow_module_level=True)
|
||||||
Loading…
x
Reference in New Issue
Block a user