Exemplo n.º 1
0
def test_get_line():
    sl = SourceLog(ssh_params={'hostname': 'localhost',
                               },
                   filepath=PATH_TEST_LOG,
                   )
    sl.p = DummyProcess()
    line = sl.get_line().rstrip()
    assert line == 'line1'
Exemplo n.º 2
0
def test__assemble_ssh_command1():
    sl = SourceLog(ssh_params={'hostname': 'localhost',
                               },
                   filepath=PATH_TEST_LOG,
                   )
    sl._assemble_ssh_command()
    assert sl.ssh_params['host'] == 'localhost'
    assert sl.ssh_cmd == 'ssh  localhost "tail --follow=name %s"' % PATH_TEST_LOG
Exemplo n.º 3
0
def test__assemble_ssh_command2():
    sl = SourceLog(ssh_params={'hostname': 'localhost',
                               'host': 'local',
                               'identityfile': '/home/smithers/.ssh/id_rsa',
                               },
                   filepath=PATH_TEST_LOG,
                   )
    sl._assemble_ssh_command()
    assert sl.ssh_params['host'] == 'local'
    assert sl.ssh_cmd == 'ssh -oidentityfile=/home/smithers/.ssh/id_rsa localhost "tail --follow=name %s"' % PATH_TEST_LOG
Exemplo n.º 4
0
def test_get_line():
    sl = SourceLog(
        ssh_params={
            'hostname': 'localhost',
        },
        filepath=PATH_TEST_LOG,
    )
    sl.p = DummyProcess()
    line = sl.get_line().rstrip()
    assert line == 'line1'
Exemplo n.º 5
0
def test__assemble_ssh_command1():
    sl = SourceLog(
        ssh_params={
            'hostname': 'localhost',
        },
        filepath=PATH_TEST_LOG,
    )
    sl._assemble_ssh_command()
    assert sl.ssh_params['host'] == 'localhost'
    assert sl.ssh_cmd == 'ssh  localhost "tail --follow=name %s"' % PATH_TEST_LOG
Exemplo n.º 6
0
def test__assemble_ssh_command2():
    sl = SourceLog(
        ssh_params={
            'hostname': 'localhost',
            'host': 'local',
            'identityfile': '/home/smithers/.ssh/id_rsa',
        },
        filepath=PATH_TEST_LOG,
    )
    sl._assemble_ssh_command()
    assert sl.ssh_params['host'] == 'local'
    assert sl.ssh_cmd == 'ssh -oidentityfile=/home/smithers/.ssh/id_rsa localhost "tail --follow=name %s"' % PATH_TEST_LOG