예제 #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'
예제 #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
예제 #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
예제 #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'
예제 #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
예제 #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