コード例 #1
0
def test_do_select_all(test_dao):
    """ do_select_all() should return a treelib Tree() on success when selecting OpLoads. """
    DUT = dtmOpLoad(test_dao)
    _tree = DUT.do_select_all(parent_id=1)

    assert isinstance(_tree, Tree)
    assert isinstance(_tree.get_node(1).data, RAMSTKOpLoad)
コード例 #2
0
def test_create_opload_data_model(test_dao):
    """ __init__() should return instance of OpLoad data model. """
    DUT = dtmOpLoad(test_dao)

    assert isinstance(DUT, dtmOpLoad)
    assert isinstance(DUT.tree, Tree)
    assert isinstance(DUT.dao, DAO)
コード例 #3
0
def test_do_select_non_existent_id(test_dao):
    """ do_select() should return None when a non-existent OpLoad ID is requested. """
    DUT = dtmOpLoad(test_dao)
    DUT.do_select_all(parent_id=1)

    _opload = DUT.do_select('100')

    assert _opload is None
コード例 #4
0
def test_do_delete_non_existent_id(test_dao):
    """ do_delete() should return a non-zero error code when passed a OpLoad ID that doesn't exist. """
    DUT = dtmOpLoad(test_dao)
    DUT.do_select_all(parent_id=1)

    _error_code, _msg = DUT.do_delete(300)

    assert _error_code == 2005
    assert _msg == ("  RAMSTK ERROR: Attempted to delete non-existent OpLoad "
                    "ID 300.")
コード例 #5
0
def test_do_delete(test_dao):
    """ do_delete() should return a zero error code on success. """
    DUT = dtmOpLoad(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.")
コード例 #6
0
def test_do_select(test_dao):
    """ do_select() should return an instance of the RAMSTKOpLoad data model on success. """
    DUT = dtmOpLoad(test_dao)
    DUT.do_select_all(parent_id=1)

    _opload = DUT.do_select(1)

    assert isinstance(_opload, RAMSTKOpLoad)
    assert _opload.load_id == 1
    assert _opload.description == 'Test Operating Load'
コード例 #7
0
def test_do_insert(test_dao):
    """ do_insert() should return a zero error code on success. """
    DUT = dtmOpLoad(test_dao)
    DUT.do_select_all(parent_id=1)

    _error_code, _msg = DUT.do_insert(mechanism_id=1)

    assert _error_code == 0
    assert _msg == ("RAMSTK SUCCESS: Adding one or more items to the RAMSTK "
                    "Program database.")
    assert DUT.last_id == 2
コード例 #8
0
def test_do_update_all(test_dao):
    """ do_update_all() should return a zero error code on success. """
    DUT = dtmOpLoad(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 operating loads in the damage "
        "modeling worksheet.")
コード例 #9
0
def test_do_update(test_dao):
    """ do_update() should return a zero error code on success. """
    DUT = dtmOpLoad(test_dao)
    DUT.do_select_all(parent_id=1)

    _opload = DUT.do_select(1)
    _opload.pof_include = 1

    _error_code, _msg = DUT.do_update(1)

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