Esempio n. 1
0
def test_do_select_non_existent_id(test_dao):
    """ do_select() should return None when a non-existent Action ID is requested. """
    DUT = dtmAction(test_dao)
    DUT.do_select_all(parent_id=1)
    _action = DUT.do_select(100)

    assert _action is None
Esempio n. 2
0
def test_do_select_all_hardware(test_dao):
    """ do_select_all() should return a Tree() object populated with RAMSTKAction instances on success. """
    DUT = dtmAction(test_dao)
    _tree = DUT.do_select_all(parent_id=1)

    assert isinstance(_tree, Tree)
    assert isinstance(_tree.get_node(1).data, RAMSTKAction)
Esempio n. 3
0
def test_do_select(test_dao):
    """ do_select() should return an instance of the RAMSTKAction data model on success. """
    DUT = dtmAction(test_dao)
    DUT.do_select_all(parent_id=1)
    _action = DUT.do_select(1)

    assert isinstance(_action, RAMSTKAction)
    assert _action.action_id == 1
    assert _action.action_due_date == date.today() + timedelta(days=30)
Esempio n. 4
0
def test_do_update_all(test_dao):
    """ do_update_all() should return a zero error code on success. """
    DUT = dtmAction(test_dao)
    DUT.do_select_all(parent_id=1)

    _error_code, _msg = DUT.do_update_all()

    assert _error_code == 0
    assert _msg == ("RAMSTK SUCCESS: Updating all records in the FMEA actions "
                    "table.")
Esempio n. 5
0
def test_do_update_non_existent_id(test_dao):
    """ do_update() should return a non-zero error code when passed an Action ID that doesn't exist. """
    DUT = dtmAction(test_dao)
    DUT.do_select_all(parent_id=1)

    _error_code, _msg = DUT.do_update(100)

    assert _error_code == 2006
    assert _msg == (
        "RAMSTK ERROR: Attempted to save non-existent Action ID 100.")
Esempio n. 6
0
def test_do_delete(test_dao):
    """ do_delete() should return a zero error code on success. """
    DUT = dtmAction(test_dao)
    DUT.do_select_all(parent_id=1)

    _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.")
Esempio n. 7
0
def test_do_insert_hardware_mode(test_dao):
    """ do_insert() should return False on success when inserting a hardware FMEA action. """
    DUT = dtmAction(test_dao)
    DUT.do_select_all(parent_id=1)

    _error_code, _msg = DUT.do_insert(mode_id=-1, cause_id=1)

    assert _error_code == 0
    assert _msg == (
        "RAMSTK SUCCESS: Adding one or more items to the RAMSTK Program "
        "database.")
Esempio n. 8
0
def test_do_update(test_dao):
    """ do_update() should return a zero error code on success. """
    DUT = dtmAction(test_dao)
    DUT.do_select_all(parent_id=1)

    _action = DUT.tree.get_node(1).data
    _action.action_recommended = ("Test Functional FMEA Recommended Action #1 "
                                  "for Cause ID 1")

    _error_code, _msg = DUT.do_update(1)

    assert _error_code == 0
    assert _msg == ("RAMSTK SUCCESS: Updating the RAMSTK Program database.")
Esempio n. 9
0
def test_create_data_model(test_dao):
    """ __init__() should return instance of Action data model. """
    DUT = dtmAction(test_dao)

    assert isinstance(DUT, dtmAction)
    assert DUT.last_id is None