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

    _hardware = DUT.do_select(100)

    assert _hardware is None
Beispiel #2
0
def test_data_model_create(test_dao):
    """ __init__() should return a Hardware model. """
    DUT = dtmHardware(test_dao)

    assert isinstance(DUT, dtmHardware)
    assert isinstance(DUT.tree, Tree)
    assert isinstance(DUT.dao, DAO)
    assert DUT._tag == 'Hardware'
Beispiel #3
0
def test_do_select_all(test_dao):
    """ do_select_all() should return a Tree() object populated with RAMSTKHardware instances on success. """
    DUT = dtmHardware(test_dao)

    _tree = DUT.do_select_all(revision_id=1)

    assert isinstance(_tree, Tree)
    assert isinstance(_tree.get_node(1).data, RAMSTKHardware)
Beispiel #4
0
def test_do_update_all(test_dao):
    """ do_update_all() should return a zero error code on success. """
    DUT = dtmHardware(test_dao)
    DUT.do_select_all(revision_id=1)

    _error_code, _msg = DUT.do_update_all()

    assert _error_code == 0
    assert _msg == ("RAMSTK SUCCESS: Updating all records in the hardware table.")
Beispiel #5
0
def test_do_delete_assembly(test_dao):
    """ do_delete() should return a zero error code on success when deleting a Hardware assembly. """
    DUT = dtmHardware(test_dao)
    DUT.do_select_all(revision_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.')
Beispiel #6
0
def test_do_insert_child_assembly(test_dao):
    """ do_insert() should return False on success when inserting a child Hardware assembly. """
    DUT = dtmHardware(test_dao)
    DUT.do_select_all(revision_id=1)

    _error_code, _msg = DUT.do_insert(revision_id=1, parent_id=1, part=0)

    assert _error_code == 0
    assert _msg == ('RAMSTK SUCCESS: Adding one or more items to the RAMSTK Program '
                    'database.')
Beispiel #7
0
def test_do_select(test_dao):
    """ do_select() should return an instance of the RAMSTKHardware data model on success. """
    DUT = dtmHardware(test_dao)
    DUT.do_select_all(revision_id=1)

    _hardware = DUT.do_select(1)

    assert isinstance(_hardware, RAMSTKHardware)
    assert _hardware.hardware_id == 1
    assert _hardware.cage_code == ''
Beispiel #8
0
def test_do_update_non_existent_id(test_dao):
    """ do_update() should return a non-zero error code when passed a Hardware ID that doesn't exist. """
    DUT = dtmHardware(test_dao)
    DUT.do_select_all(revision_id=1)

    _error_code, _msg = DUT.do_update(100)

    assert _error_code == 2006
    assert _msg == ('RAMSTK ERROR: Attempted to save non-existent Hardware ID '
                    '100.')
Beispiel #9
0
def test_do_delete_assembly_non_existent_id(test_dao):
    """ do_delete() should return a non-zero error code when passed a Hardware assembly with an ID that doesn't exist. """
    DUT = dtmHardware(test_dao)
    DUT.do_select_all(revision_id=1)

    _error_code, _msg = DUT.do_delete(300)

    assert _error_code == 2005
    assert _msg == ('  RAMSTK ERROR: Attempted to delete non-existent Hardware '
                    'ID 300.')
Beispiel #10
0
def test_do_update(test_dao):
    """ do_update() should return a zero error code on success. """
    DUT = dtmHardware(test_dao)
    DUT.do_select_all(revision_id=1)

    _hardware = DUT.do_select(1)
    _hardware.availability_logistics = 0.9832

    _error_code, _msg = DUT.do_update(1)

    assert _error_code == 0
    assert _msg == ('RAMSTK SUCCESS: Updating the RAMSTK Program database.')
Beispiel #11
0
def test_do_make_composite_reference_designator(test_dao):
    """ do_make_composite_ref_des() should return False on success. """
    DUT = dtmHardware(test_dao)
    DUT.do_select_all(revision_id=1)

    assert not DUT.do_make_composite_ref_des()