def test_parse_missing_args(args):
    log.info(args)
    parser = ParserHelper()
    with signtool_env():
        with pytest.raises(SystemExit):
            stool.parse_cmdln_opts(parser, args[0])
    assert parser.msg == args[1]
def test_invalid_fmts(fmt):
    log.info(fmt)
    parser = ParserHelper()
    with signtool_env():
        with pytest.raises(SystemExit):
            stool.parse_cmdln_opts(parser, FMTS_ARGS + [fmt])
    assert parser.msg.startswith("invalid format:")
Example #3
0
def test_parse_missing_args(args):
    log.info(args)
    parser = ParserHelper()
    with signtool_env():
        with pytest.raises(SystemExit):
            stool.parse_cmdln_opts(parser, args[0])
    assert parser.msg == args[1]
def test_missing_fmts(fmt):
    log.info(fmt)
    parser = ParserHelper()
    with signtool_env():
        with pytest.raises(SystemExit):
            stool.parse_cmdln_opts(parser, FMTS_ARGS + [fmt])
    assert parser.msg.startswith("no hosts capable of signing")
Example #5
0
def test_invalid_fmts(fmt):
    log.info(fmt)
    parser = ParserHelper()
    with signtool_env():
        with pytest.raises(SystemExit):
            stool.parse_cmdln_opts(parser, FMTS_ARGS + [fmt])
    assert parser.msg.startswith("invalid format:")
Example #6
0
def test_missing_fmts(fmt):
    log.info(fmt)
    parser = ParserHelper()
    with signtool_env():
        with pytest.raises(SystemExit):
            stool.parse_cmdln_opts(parser, FMTS_ARGS + [fmt])
    assert parser.msg.startswith("no hosts capable of signing")
def test_parse_nss(args):
    log.debug(args)
    parser = ParserHelper()
    with mock.patch('sys.platform', new=args[0]):
        with signtool_env():
            options, _ = stool.parse_cmdln_opts(parser, NSS_ARGS + [args[1]])
    assert options.nsscmd == args[2]
Example #8
0
def test_parse_nss(args):
    log.debug(args)
    parser = ParserHelper()
    with mock.patch('sys.platform', new=args[0]):
        with signtool_env():
            options, _ = stool.parse_cmdln_opts(parser, NSS_ARGS + [args[1]])
    assert options.nsscmd == args[2]
def test_parse_output_file():
    parser = ParserHelper()
    with signtool_env():
        with pytest.raises(SystemExit):
            stool.parse_cmdln_opts(parser, GOOD_ARGS + ['-o', '.', "."])
    assert parser.msg == "-o / --output-file can only be used when signing a single file"
def test_parse_missing_cert():
    parser = ParserHelper()
    with pytest.raises(SystemExit):
        stool.parse_cmdln_opts(parser, BASE_ARGS)
    assert parser.msg == "certificate not found"
def test_good_fmts(args):
    log.info(args)
    parser = ParserHelper()
    with signtool_env():
        options, _ = stool.parse_cmdln_opts(parser, FMTS_ARGS + args[0])
    assert options.formats == list(args[1])
def test_parse_output_dir():
    parser = ParserHelper()
    with signtool_env():
        with pytest.raises(SystemExit):
            stool.parse_cmdln_opts(parser, GOOD_ARGS + ['-d', 'cert', "."])
    assert parser.msg.startswith("output_dir (")
Example #13
0
def test_parse_output_file():
    parser = ParserHelper()
    with signtool_env():
        with pytest.raises(SystemExit):
            stool.parse_cmdln_opts(parser, GOOD_ARGS + ['-o', '.', "."])
    assert parser.msg == "-o / --output-file can only be used when signing a single file"
Example #14
0
def test_parse_missing_cert():
    parser = ParserHelper()
    with pytest.raises(SystemExit):
        stool.parse_cmdln_opts(parser, BASE_ARGS)
    assert parser.msg == "certificate not found"
Example #15
0
def test_good_fmts(args):
    log.info(args)
    parser = ParserHelper()
    with signtool_env():
        options, _ = stool.parse_cmdln_opts(parser, FMTS_ARGS + args[0])
    assert options.formats == list(args[1])
Example #16
0
def test_parse_output_dir():
    parser = ParserHelper()
    with signtool_env():
        with pytest.raises(SystemExit):
            stool.parse_cmdln_opts(parser, GOOD_ARGS + ['-d', 'cert', "."])
    assert parser.msg.startswith("output_dir (")