Ejemplo n.º 1
0
def test_cli_boolean_args():
    """test parser for boolean arguments"""
    args = CLI.parse_args(["--version"])
    assert args.version is True

    args = CLI.parse_args(["--test"])
    assert args.test is True

    args = CLI.parse_args(["--print-config-file"])
    assert args.print_config_file is True

    args = CLI.parse_args(["-T"])
    assert args.check_login is True
Ejemplo n.º 2
0
def test_cli_argparse():
    """test parser for different arguments"""
    args = CLI.parse_args(["-t", "0664123456"])
    assert args.recipient == "0664123456"

    args = CLI.parse_args(["--to", "0664123456"])
    assert args.recipient == "0664123456"

    args = CLI.parse_args(["-l", "0676456789123"])
    assert args.login == "0676456789123"

    args = CLI.parse_args(["--login", "0676456789123"])
    assert args.login == "0676456789123"

    args = CLI.parse_args(["-p", "s3cret..11"])
    assert args.password == "s3cret..11"

    args = CLI.parse_args(["--password", "s3cret..11"])
    assert args.password == "s3cret..11"

    args = CLI.parse_args(["-c", ".yessssms.config"])
    assert args.configfile == ".yessssms.config"

    args = CLI.parse_args(["--configfile", ".yessssms.config"])
    assert args.configfile == ".yessssms.config"

    args = CLI.parse_args(["--message", "testmessage 123 - can you see this?"])
    assert args.message == "testmessage 123 - can you see this?"

    args = CLI.parse_args(["-m", "testmessage 123 - can you see this?"])
    assert args.message == "testmessage 123 - can you see this?"

    args = CLI.parse_args(["--mvno", "YESSS"])
    assert args.provider == "YESSS"

    args = CLI.parse_args(["--mvno", "EDUCOM"])
    assert args.provider == "EDUCOM"

    args = CLI.parse_args(["--mvno", "SIMfonie"])
    assert args.provider == "SIMfonie"

    args = CLI.parse_args(["--mvno", "BLABLABLA"])
    assert args.provider == "BLABLABLA"