Example #1
0
def test_do_select_non_existent_id(test_dao):
    """ do_select() should return None when a non-existent Reliability ID is requested. """
    DUT = dtmReliability(test_dao)

    _reliability = DUT.do_select(100)

    assert _reliability is None
Example #2
0
def test_do_load_output_reliability(test_dao):
    """do_load_output() should return None when loading Reliability for export."""
    DUT = dtmExports(test_dao)

    _hardware = dtmReliability(test_dao)
    _tree = _hardware.do_select_all(hardware_id=1)

    assert DUT.do_load_output('Reliability', _tree) is None
Example #3
0
def test_do_select_all(test_dao):
    """ do_select_all() should return a Tree() object populated with RAMSTKReliability instances on success. """
    DUT = dtmReliability(test_dao)

    _tree = DUT.do_select_all(hardware_id=2)

    assert isinstance(_tree, Tree)
    assert isinstance(_tree.get_node(2).data, RAMSTKReliability)
Example #4
0
def test_create(test_dao):
    """ __init__() should return a Reliability model. """
    DUT = dtmReliability(test_dao)

    assert isinstance(DUT, dtmReliability)
    assert isinstance(DUT.tree, Tree)
    assert isinstance(DUT.dao, DAO)
    assert DUT._tag == 'Reliability'
Example #5
0
def test_do_delete_non_existent_id(test_dao):
    """ do_delete() should return a non-zero error code when passed a Reliability ID that doesn't exist. """
    DUT = dtmReliability(test_dao)
    DUT.do_select_all(hardware_id=3)

    _error_code, _msg = DUT.do_delete(300)

    assert _error_code == 2005
    assert _msg == ('  RAMSTK ERROR: Attempted to delete non-existent '
                    'Reliability record ID 300.')
Example #6
0
def test_do_delete(test_dao):
    """ do_delete() should return a zero error code on success. """
    DUT = dtmReliability(test_dao)
    DUT.do_select_all(hardware_id=4)

    _error_code, _msg = DUT.do_delete(DUT.last_id)

    assert _error_code == 0
    assert _msg == ('RAMSTK SUCCESS: Deleting an item from the RAMSTK Program '
                    'database.')
Example #7
0
def test_do_select(test_dao):
    """ do_select() should return an instance of the RAMSTKReliability data model on success. """
    DUT = dtmReliability(test_dao)
    DUT.do_select_all(hardware_id=2)

    _reliability = DUT.do_select(2)

    assert isinstance(_reliability, RAMSTKReliability)
    assert _reliability.hardware_id == 2
    assert _reliability.hazard_rate_percent == 0.0
Example #8
0
def test_do_update_all(test_dao):
    """ do_update_all() should return a zero error code on success. """
    DUT = dtmReliability(test_dao)
    DUT.do_select_all(hardware_id=3)

    _error_code, _msg = DUT.do_update_all()

    assert _error_code == 0
    assert _msg == ("RAMSTK SUCCESS: Updating all records in the reliability "
                    "table.")
Example #9
0
def test_do_insert(test_dao):
    """ do_insert() should return False on success when inserting a Reliability record. """
    DUT = dtmReliability(test_dao)
    DUT.do_select_all(hardware_id=3)

    _error_code, _msg = DUT.do_insert(hardware_id=90)

    assert _error_code == 0
    assert _msg == (
        'RAMSTK SUCCESS: Adding one or more items to the RAMSTK Program '
        'database.')
Example #10
0
def test_do_update(test_dao):
    """ do_update() should return a zero error code on success. """
    DUT = dtmReliability(test_dao)
    DUT.do_select_all(hardware_id=3)

    _design_electric = DUT.do_select(3)
    _design_electric.resistance = 0.9832

    _error_code, _msg = DUT.do_update(3)

    assert _error_code == 0
    assert _msg == ('RAMSTK SUCCESS: Updating the RAMSTK Program database.')