コード例 #1
0
def test_init_args_spn(capfd):
    # Test init of EnumAD -spn
    main(['domain.local', '-u', '*****@*****.**', '-spn', '--dry-run'])
    out, err = capfd.readouterr()
    assert "domain.local" in out
    assert "*****@*****.**" in out
    assert "False None False False True False False" in out
    assert "['domain', 'local'] dc=domain,dc=local," in out
コード例 #2
0
def test_init_args_o(capfd):
    # Test init of EnumAD -o
    main([
        'domain.local', '-u', '*****@*****.**', '-o', 'some/path',
        '--dry-run'
    ])
    out, err = capfd.readouterr()
    assert "domain.local" in out
    assert "*****@*****.**" in out
    assert "False some/path False False False False False" in out
    assert "['domain', 'local'] dc=domain,dc=local," in out
コード例 #3
0
def test_argparse():
    # Test help
    with pytest.raises(SystemExit) as wrapper:
        main(['-h'])
    assert wrapper.type == SystemExit
    assert wrapper.value.code == 0
コード例 #4
0
def test_user_arg():
    # Test regex for incorrect user format
    with pytest.raises(SystemExit) as wrapper:
        main(['domain.local', '-u', 'johndoe', '--dry-run'])
    assert wrapper.type == SystemExit
    assert wrapper.value.code == 1
コード例 #5
0
def test_domain_arg():
    # Test regex for incorrect domain format
    with pytest.raises(SystemExit) as wrapper:
        main(['12345', '--no-creds', '--dry-run'])
    assert wrapper.type == SystemExit
    assert wrapper.value.code == 1
コード例 #6
0
#!/usr/bin/env python
import ade
import sys

ade.main(sys.argv)