def _test_cleanup_processing_rows(self, last_retried, expected_state): # Create a dummy network (creates db row in pending state). self._call_operation_object(odl_const.ODL_CREATE, odl_const.ODL_NETWORK) # Get pending row and mark as processing and update # the last_retried time row = db.get_all_db_rows_by_state(self.db_context, odl_const.PENDING)[0] row.last_retried = last_retried db.update_db_row_state(self.db_context, row, odl_const.PROCESSING) # Test if the cleanup marks this in the desired state # based on the last_retried timestamp cleanup.cleanup_processing_rows(self.db_context) # Verify that the Db row is in the desired state rows = db.get_all_db_rows_by_state(self.db_context, expected_state) self.assertEqual(1, len(rows))