This commit is contained in:
jpic 2020-03-04 02:14:54 +01:00
parent ea061db51f
commit d16a761241
5 changed files with 72 additions and 0 deletions

7
test_cli.py Normal file
View 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
View 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
View File

@ -0,0 +1,5 @@
from shlax.play import Play
def test_play_call():

47
tests/test_shlax.py Normal file
View 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
View 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)