def setUp(self):

        # set pexpect-delay to 0 to speed up tests
        session_config = typetastic.session_config.SessionConfig()
        session_config.set("pexpect-delay", 0)

        self.robot = typetastic.Robot()
        self.robot.load(session_config.get())
Beispiel #2
0
    def test_cd_command_bad_dir(self):
        """Test change dir return true."""
        # pylint: disable=protected-access

        self.handler_data["command"] = "cd ["
        robot = typetastic.Robot()

        self.assertFalse(robot.run_task(self.handler_data))
Beispiel #3
0
    def test_load_valid_commands_array(self):
        """Test loading a valid array updates commands."""
        # pylint: disable=protected-access
        data = ["echo 'Hello, World!'", "ls"]
        robot = typetastic.Robot()
        robot.load(data)
        robot_data = robot._get_data()

        self.assertEqual(robot_data["commands"], data)
Beispiel #4
0
    def test_load_invalid_yaml_dict(self):
        """Test loading an invalid yaml file does not change data."""
        # pylint: disable=protected-access
        data = {"my": "test dict"}
        robot = typetastic.Robot()
        pre_test_copy = copy.deepcopy(robot._get_data())
        robot.load(data)

        self.assertEqual(robot._get_data(), pre_test_copy)
Beispiel #5
0
def main():
    """Run a typetastic file."""

    arg_parser = argparse.ArgumentParser()
    arg_parser.add_argument("inputfile")
    args = arg_parser.parse_args()

    robot = typetastic.Robot()
    robot.load(args.inputfile)
    robot.run()
Beispiel #6
0
    def test_load_ssh_commands(self):
        """Test loading ssh commands as nested arrays."""
        # pylint: disable=protected-access

        data = ["ls", {"ssh": ["ssh user@host", "ls", "exit"]}, "whoami"]

        robot = typetastic.Robot()
        robot.load(data)
        robot_data = robot._get_data()

        self.assertEqual(robot_data["commands"], data)
    def test_python_command_set(self):
        """Test successful commands count running python set."""
        # pylint: disable=protected-access

        data_file = "tests/data/typetastic-python-command-set.yaml"

        robot = typetastic.Robot()
        robot.load(data_file)
        robot.run()

        self.assertEqual(robot._get_successful_commands(), 5)
    def setUp(self):
        """Configure the context."""

        # set pexpect-delay to 0 to speed up tests
        session_config = typetastic.session_config.SessionConfig()
        session_config.set("pexpect-delay", 0)
        session_config.set("typing-speed", "supersonic")
        config = {"config": session_config.get()}

        self.robot = typetastic.Robot()
        self.robot.load(config)
Beispiel #9
0
    def test_load_valid_yaml_dict(self):
        """Test loading a valid yaml file."""
        # pylint: disable=protected-access

        data = {
            "config": {
                "local-prompt": "$ ",
                "pexpect-delay": 0.2,  # delay required for response to be read
                "prompt-string": "$ ",
                "remote-prompt": "[ssh] $ ",
                "typing-color": "cyan",
                "typing-speed": "moderate"
            },
            "commands": ["echo 'Hello, World!'", "ls"]
        }

        robot = typetastic.Robot()
        robot.load(data)

        robot_data = robot._get_data()
        robot_data["config"] = robot._get_config()

        self.assertEqual(robot_data, data)
# TypeTastic - Python utility to make creating screencasts easier, and doing live demo's less stressful.

# PyPi: https://pypi.org/project/typetastic/

# pip install typetastic

# TypeTastic uses a Robot to type commands for you. In the simplest form you can pass the commands in as an array.
import typetastic


robot = typetastic.Robot()
robot.load(['ls', 'echo "Hello World\!"'])
robot.run()


# Something Useful
"""
tt-robot.py

# Run a typetastic command file.

# Usage:
   tt-robot.py <file>

import argparse
import typetastic


def main():
    """Run a typetastic file."""