def test_dao_db_delete(test_configuration): """ db_delete() should return a zero error code on success. """ DUT = DAO() _database = (test_configuration.RAMSTK_BACKEND + ':///' + TEMPDIR + '/_ramstk_program_db.ramstk') DUT.db_connect(_database) _revision = RAMSTKRevision() DUT.db_add([ _revision, ], DUT.session) _error_code, _msg = DUT.db_delete(_revision, DUT.session) assert _error_code == 0 assert _msg == ("RAMSTK SUCCESS: Deleting an item from the RAMSTK Program " "database.")
def test_dao_db_update(test_configuration): """ db_update() should return a zero error code on success. """ DUT = DAO() _database = (test_configuration.RAMSTK_BACKEND + ':///' + TEMPDIR + '/_ramstk_program_db.ramstk') DUT.db_connect(_database) _revision = RAMSTKRevision() DUT.db_add([ _revision, ], DUT.session) _revision.availability_logistics = 0.9959 _revision.availability_mission = 0.9999 _error_code, _msg = DUT.db_update(DUT.session) assert _error_code == 0 assert _msg == ("RAMSTK SUCCESS: Updating the RAMSTK Program database.")
def test_dao_db_add(test_configuration): """ db_add() should return a zero error code on success when adding a single record to the database. """ DUT = DAO() _database = (test_configuration.RAMSTK_BACKEND + ':///' + TEMPDIR + '/_ramstk_program_db.ramstk') DUT.db_connect(_database) _error_code, _msg = DUT.db_add([ RAMSTKRevision(), ], DUT.session) assert _error_code == 0 assert _msg == ("RAMSTK SUCCESS: Adding one or more items to the RAMSTK " "Program database.")
def test_dao_db_add_no_item(test_configuration): """ db_add() should return a 1003 error code on failure. """ DUT = DAO() _database = (test_configuration.RAMSTK_BACKEND + ':///' + TEMPDIR + '/_ramstk_program_db.ramstk') DUT.db_connect(_database) _error_code, _msg = DUT.db_add([ None, ], DUT.session) assert _error_code == 1 assert _msg == ("RAMSTK ERROR: Adding one or more items to the RAMSTK " "Program database.")