def delete(confirmed=None): """Delete monkey's profile.""" monkey_self = dba.get_monkey_by_id(session['id']) if monkey_self is None: return redirect(url_for('index')) if confirmed == 'confirmed': if dba.delete_monkey(monkey_self): # If deleted, log out: session.pop('id', None) flash('Profile deleted') return redirect(url_for('index')) else: flash('Error deleting profile!') return redirect(url_for('edit')) else: return render_template('delete.html', monkey_self=monkey_self)
def test_delete_monkey(self, test_monkey): """Test delete_monkey().""" monkey = test_monkey assert dba.delete_monkey(monkey)