Ejemplo n.º 1
0
def _not_isfile_checks():
    print ()
    print (" --- not file type checks --- ")
    print ()

    _objadj = 'object is '
    _objvrb = 'a file '
    _objsep = ': '

    print (" positive check ")
    print ()

    obj = test_objects + '_isfile_not'

    # existence check is just for us
    if dom._exists(obj):
        if dom._not_isfile(obj):
            _bool = 'not '
            msg = _objadj + _bool + _objvrb + _objsep + obj
            dcm._pass(msg)
        else:
            _bool = ''
            msg = _objadj + _bool + _objvrb + _objsep + obj
            dcm._fail(msg)
            raise SystemExit
    else:
        dcm._halt("object is missing" + _objsep + obj)
        raise SystemExit

    print ()
    print (" negative check ")
    print ()

    obj = test_objects + '_isfile'

    # existence check is just for us
    if dom._exists(obj):
        if not dom._not_isfile(obj):
            _bool = ''
            msg = _objadj + _bool + _objvrb + _objsep + obj
            dcm._pass(msg)
        else:
            _bool = 'not '
            msg = _objadj + _bool + _objvrb + _objsep + obj
            dcm._fail(msg)
            raise SystemExit
    else:
        dcm._halt("object is missing" + _objsep + obj)
        raise SystemExit
Ejemplo n.º 2
0
def _not_gid_owns_checks():
    print ()
    print (" --- object gid not owns checks --- ")
    print ()

    _objadj = 'object is '
    _objvrb = 'owned by gid '
    _objsep = ': '

    print (" positive check ")
    print ()

    obj = test_objects + '_gid_owns_not'

    # existence check is just for us
    if dom._exists(obj):
        if dom._not_gid_owns(obj):
            _bool = 'not '
            msg = _objadj + _bool + _objvrb + _objsep + obj
            dcm._pass(msg)
        else:
            _bool = ''
            msg = _objadj + _bool + _objvrb + _objsep + obj
            dcm._fail(msg)
            raise SystemExit
    else:
        dcm._halt("object is missing" + _objsep + obj)
        raise SystemExit

    print ()
    print (" negative check ")
    print ()

    obj = test_objects + '_gid_owns'

    # existence check is just for us
    if dom._exists(obj):
        if not dom._not_gid_owns(obj):
            _bool = ''
            msg = _objadj + _bool + _objvrb + _objsep + obj
            dcm._pass(msg)
        else:
            _bool = 'not '
            msg = _objadj + _bool + _objvrb + _objsep + obj
            dcm._fail(msg)
            raise SystemExit
    else:
        dcm._halt("object is missing" + _objsep + obj)
        raise SystemExit
Ejemplo n.º 3
0
def _msg_checks():
    """Test message functions with and without parameters"""
    print ()
    print (" --- messages tests --- ")
    print ()

    print (" basic message test ")
    print ()

    dcm._info("info test message")
    dcm._pass("pass test message")
    dcm._warn("warn test message")
    dcm._fail("fail test message")
    dcm._halt("halt test message")

    print ()
    print (" blank message test ")
    print ()

    dcm._info("")
    dcm._pass("")
    dcm._warn("")
    dcm._fail("")
    dcm._halt("")

    print ()
    print (" null message tests ")
    print ()

    dcm._info()
    dcm._pass()
    dcm._warn()
    dcm._fail()
    dcm._halt()
Ejemplo n.º 4
0
def _not_id_owns_checks():
    print ()
    print (" --- object id not owns checks --- ")
    print ()

    _objadj = 'object is '
    _objvrb = {}
    _objvrb['uid'] = 'owned by uid '
    _objvrb['gid'] = 'owned by gid '
    _objsep = ': '

    print (" positive checks (uid)")
    print ()

    obj = test_objects + '_id_uid_owns_not'

    # existence check is just for us
    if dom._exists(obj):
        if dom._not_id_owns(obj):
            _bool = 'not '
            _junct = 'or is '
            msg = _objadj + _bool + _objvrb['uid'] + _junct + _bool + _objvrb['gid'] + _objsep + obj
            dcm._pass(msg)
        else:
            _bool = ''
            _junct = 'and is '
            msg = _objadj + _bool + _objvrb['uid'] + _junct + _bool + _objvrb['gid'] + _objsep + obj
            dcm._fail(msg)
            raise SystemExit
    else:
        dcm._halt("object is missing" + _objsep + obj)
        raise SystemExit

    print ()
    print (" positive checks (gid)")
    print ()

    obj = test_objects + '_id_gid_owns_not'

    # existence check is just for us
    if dom._exists(obj):
        if dom._not_id_owns(obj):
            _bool = 'not '
            _junct = 'or is '
            msg = _objadj + _bool + _objvrb['uid'] + _junct + _bool + _objvrb['gid'] + _objsep + obj
            dcm._pass(msg)
        else:
            _bool = ''
            _junct = 'and is '
            msg = _objadj + _bool + _objvrb['uid'] + _junct + _bool + _objvrb['gid'] + _objsep + obj
            dcm._fail(msg)
            raise SystemExit
    else:
        dcm._halt("object is missing" + _objsep + obj)
        raise SystemExit

    print ()
    print (" positive checks (uid and gid)")
    print ()

    obj = test_objects + '_id_uid_gid_owns_not'

    # existence check is just for us
    if dom._exists(obj):
        if dom._not_id_owns(obj):
            _bool = 'not '
            _junct = 'or is '
            msg = _objadj + _bool + _objvrb['uid'] + _junct + _bool + _objvrb['gid'] + _objsep + obj
            dcm._pass(msg)
        else:
            _bool = ''
            _junct = 'and is '
            msg = _objadj + _bool + _objvrb['uid'] + _junct + _bool + _objvrb['gid'] + _objsep + obj
            dcm._fail(msg)
            raise SystemExit
    else:
        dcm._halt("object is missing" + _objsep + obj)
        raise SystemExit

    print ()
    print (" negative check ")
    print ()

    obj = test_objects + '_id_owns'

    # existence check is just for us
    if dom._exists(obj):
        if not dom._not_id_owns(obj):
            _bool = ''
            _junct = 'and is '
            msg = _objadj + _bool + _objvrb['uid'] + _junct + _bool + _objvrb['gid'] + _objsep + obj
            dcm._pass(msg)
        else:
            _bool = 'not '
            _junct = 'or is '
            msg = _objadj + _bool + _objvrb['uid'] + _junct + _bool + _objvrb['gid'] + _objsep + obj
            dcm._fail(msg)
            raise SystemExit
    else:
        dcm._halt("object is missing" + _objsep + obj)
        raise SystemExit