def METHOD_NAME(self):
    app = flask.Flask(__name__)
    app.config['SECRET_KEY'] = 'secret'
    @app.route('/')
    def index():
        flask.flash('This is a flash message', category='notice')
        return flask.redirect('/other')
    recorded = []
    def record(sender, message, category):
        recorded.append((message, category))
    flask.message_flashed.connect(record, app)
    try:
        client = app.test_client()
        with client.session_transaction():
            client.get('/')
            self.assert_equal(len(recorded), 1)
            message, category = recorded[0]
            self.assert_equal(message, 'This is a flash message')
            self.assert_equal(category, 'notice')
    finally:
        flask.message_flashed.disconnect(record, app)