How to use tomcatmanager - 10 common examples

To help you get started, we’ve selected a few tomcatmanager examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tomcatmanager / tomcatmanager / tests / test_main.py View on Github external
def test_main_version_with_others(tomcat_manager_server, capsys):
    cmdline = '-v -q -u {user} -p {password} {url} list'.format(**tomcat_manager_server)
    argv = cmdline.split(' ')
    with pytest.raises(SystemExit) as exit_e:
        main(argv)
    out, err = capsys.readouterr()
    out = out.splitlines()
    assert exit_e.value.code == 0
    assert out[0] == tm.VERSION_STRING
    assert not err
github tomcatmanager / tomcatmanager / tests / test_main.py View on Github external
def test_main_quiet(tomcat_manager_server, capsys):
    cmdline = '-q -u {user} -p {password} {url} list'.format(**tomcat_manager_server)
    argv = cmdline.split(' ')
    exit_code = main(argv)
    out, err = capsys.readouterr()
    out = out.splitlines()
    assert exit_code == 0
    assert 'Path' in out[0]
    assert not err
github tomcatmanager / tomcatmanager / tests / test_main.py View on Github external
def test_main_user_password_url_command(tomcat_manager_server, capsys):
    cmdline = '-u {user} -p {password} {url} list'.format(**tomcat_manager_server)
    argv = cmdline.split(' ')
    exit_code = main(argv)
    out, err = capsys.readouterr()
    out = out.splitlines()
    err = err.splitlines()
    assert exit_code == 0
    assert 'Path' in out[0]
    assert 'Sessions' in out[0]
    assert '--connected to' in err[0]
github tomcatmanager / tomcatmanager / tests / test_main.py View on Github external
def test_main_echo(tomcat_manager_server, capsys):
    inio = io.StringIO('list\n')
    stdin = sys.stdin
    cmdline = '-e -u {user} -p {password} {url}'.format(**tomcat_manager_server)
    argv = cmdline.split(' ')
    try:
        sys.stdin = inio
        exit_code = main(argv)
    finally:
        sys.stdin = stdin

    out, err = capsys.readouterr()
    out = out.splitlines()
    err = err.splitlines()
    assert exit_code == 0
    assert ' list' in out[0]
    assert 'Path' in out[1]
    assert 'Sessions' in out[1]
    assert '--connected to' in err[0]
github tomcatmanager / tomcatmanager / tests / test_main.py View on Github external
def test_main_debug(tomcat_manager_server, capsys):
    cmdline = '-d -u {user} -p {password} {url} list'.format(**tomcat_manager_server)
    argv = cmdline.split(' ')
    exit_code = main(argv)
    out, err = capsys.readouterr()
    out = out.splitlines()
    assert exit_code == 0
    assert err
    assert 'Path' in out[0]
    assert 'Sessions' in out[0]
github tomcatmanager / tomcatmanager / tests / test_main.py View on Github external
def test_main_stdin(tomcat_manager_server, capsys):
    inio = io.StringIO('list\n')
    stdin = sys.stdin
    cmdline = '-u {user} -p {password} {url}'.format(**tomcat_manager_server)
    argv = cmdline.split(' ')
    try:
        sys.stdin = inio
        exit_code = main(argv)
    finally:
        sys.stdin = stdin

    out, err = capsys.readouterr()
    out = out.splitlines()
    err = err.splitlines()
    assert exit_code == 0
    assert 'Path' in out[0]
    assert 'Sessions' in out[0]
    assert '--connected to' in err[0]
github tomcatmanager / tomcatmanager / tests / test_main.py View on Github external
def test_main_status_to_stdout(tomcat_manager_server, capsys):
    cmdline = '-s -u {user} -p {password} {url} list'.format(**tomcat_manager_server)
    argv = cmdline.split(' ')
    exit_code = main(argv)
    out, _ = capsys.readouterr()
    out = out.splitlines()
    assert exit_code == 0
    assert '--connected to' in out[0]
    assert 'Path' in out[1]
    assert 'Sessions' in out[1]
github tomcatmanager / tomcatmanager / tests / test_interactive_apps.py View on Github external
def test_list_process_apps_empty():
    lines = ''
    itm = tm.InteractiveTomcatManager()
    args = itm.parse_args(itm.list_parser, '')
    apps = parse_apps(lines)
    apps = itm._list_process_apps(apps, args)
    assert isinstance(apps, list)
    assert apps == []
github tomcatmanager / tomcatmanager / tests / test_interactive.py View on Github external
def test_set_integer_valid():
    itm = tm.InteractiveTomcatManager()
    itm.timeout = 10
    itm.onecmd_plus_hooks('set timeout=5')
    assert itm.timeout == 5
    assert itm.exit_code == itm.exit_codes.success
github tomcatmanager / tomcatmanager / tests / test_interactive_apps.py View on Github external
def get_itm(tms):
    """
    Using this as a fixture with capsys breaks capsys. So we use a function.
    """
    itm = tm.InteractiveTomcatManager()
    args = 'connect {url} {user} {password}'.format(**tms)
    itm.onecmd_plus_hooks(args)
    return itm