コード例 #1
0
ファイル: test_helpers.py プロジェクト: srm4/pyxs
def test_validate_perms():
    # A valid permission has a form `[wrbn]:digits:`.
    with pytest.raises(InvalidPermission):
        validate_perms([b"foo"])

    with pytest.raises(InvalidPermission):
        validate_perms([b"f20"])

    with pytest.raises(InvalidPermission):
        validate_perms([b"r-20"])

    # OK-case
    validate_perms(b"w0 r0 b0 n0".split())
    validate_perms([b"w999999"])  # valid, even though it overflows int32.
コード例 #2
0
ファイル: tests.py プロジェクト: brkt/pyxs
def test_validate_perms():
    # a valid permission has a form `[wrbn]:digits:`.
    with pytest.raises(InvalidPermission):
        validate_perms(["foo"])

    with pytest.raises(InvalidPermission):
        validate_perms(["f20"])

    with pytest.raises(InvalidPermission):
        validate_perms(["r-20"])

    try:
        validate_perms("w0 r0 b0 n0".split())
        validate_perms(["w999999"])  # valid, even though it overflows int32.
    except InvalidPermission as p:
        pytest.fail("{0} is prefectly valid, baby :)".format(p.args))
コード例 #3
0
ファイル: tests.py プロジェクト: royjenkins/pyxs
def test_validate_perms():
    # a valid permission has a form `[wrbn]:digits:`.
    with pytest.raises(InvalidPermission):
        validate_perms(["foo"])

    with pytest.raises(InvalidPermission):
        validate_perms(["f20"])

    with pytest.raises(InvalidPermission):
        validate_perms(["r-20"])

    try:
        validate_perms("w0 r0 b0 n0".split())
        validate_perms(["w999999"])  # valid, even though it overflows int32.
    except InvalidPermission as p:
        pytest.fail("{0} is prefectly valid, baby :)".format(p.args))