Exemplo n.º 1
0
 def __init__(self, passwords, home, pubkeys, files):
     self.event = threading.Event()
     self.passwords = passwords
     self.pubkeys = pubkeys
     self.files = FakeFilesystem(files)
     self.home = home
     self.command = None
Exemplo n.º 2
0
build
docs
fabfile.py
fabfile.pyc
fabric
requirements.txt
setup.py
tests""",
    "both_streams": ["stdout", "stderr"]
}
FILES = FakeFilesystem({
    '/file.txt': 'contents',
    '/file2.txt': 'contents2',
    '/folder/file3.txt': 'contents3',
    '/empty_folder': None,
    '/tree/file1.txt': 'x',
    '/tree/file2.txt': 'y',
    '/tree/subfolder/file3.txt': 'z',
    '/etc/apache2/apache2.conf': 'Include other.conf',
    HOME: None  # So $HOME is a directory
})
PASSWORDS = {'root': 'root', USER: '******'}


def _local_file(filename):
    return os.path.join(os.path.dirname(__file__), filename)


SERVER_PRIVKEY = _local_file('private.key')
CLIENT_PUBKEY = _local_file('client.key.pub')
CLIENT_PRIVKEY = _local_file('client.key')
Exemplo n.º 3
0

def _local_file(filename):
    return os.path.join(os.path.dirname(__file__), filename)


SERVER_KEY_PATH = os.path.join(os.path.dirname(__file__), "server-key")
HOST = '127.0.0.1'
PORT = 2200
USER = '******'
HOME = '/'
RESPONSES = {}
SERVER_PRIVKEY = _local_file('server_rsa_key.key')
CLIENT_PUBKEY = _local_file('client.key.pub')
CLIENT_PRIVKEY = _local_file('client.key')
FILES = FakeFilesystem({})


def _equalize(lists, fillval=None):
    """
    Pad all given list items in ``lists`` to be the same length.
    """
    lists = map(list, lists)
    upper = max(len(x) for x in lists)
    for lst in lists:
        diff = upper - len(lst)
        if diff:
            lst.extend([fillval] * diff)
    return lists