import flask

from pale.adapters import flask as pale_flask_adapter

from tests.example_app import api


def create_pale_flask_app():
    """Creates a flask app, and registers a blueprint bound to pale."""
    blueprint = flask.Blueprint('api', 'tests.example_app')
    pale_flask_adapter.bind_blueprint(api, blueprint)

    app = flask.Flask(__name__)
    app.register_blueprint(blueprint, url_prefix='/api')

    return app

import flask

from pale.adapters import flask as pale_flask_adapter
from pale.config import authenticator, context_creator

from tests.example_app import api


@authenticator
def authenticate_pale_context(context):
    """Don't actually authenticate anything in this test."""
    return context

@context_creator
def create_pale_context(endpoint,request):
    return pale_flask_adapter.DefaultFlaskContext(endpoint, request)


def create_pale_flask_app():
    """Creates a flask app, and registers a blueprint bound to pale."""
    blueprint = flask.Blueprint('api', 'tests.example_app')
    pale_flask_adapter.bind_blueprint(api, blueprint)

    app = flask.Flask(__name__)
    app.register_blueprint(blueprint, url_prefix='/api')

    return app

Add authenticator and context creator to example app
Add authenticator and context creator to example app

  import flask
  
  from pale.adapters import flask as pale_flask_adapter
+ from pale.config import authenticator, context_creator
  
  from tests.example_app import api
+ 
+ 
+ @authenticator
+ def authenticate_pale_context(context):
+     """Don't actually authenticate anything in this test."""
+     return context
+ 
+ @context_creator
+ def create_pale_context(endpoint,request):
+     return pale_flask_adapter.DefaultFlaskContext(endpoint, request)
  
  
  def create_pale_flask_app():
      """Creates a flask app, and registers a blueprint bound to pale."""
      blueprint = flask.Blueprint('api', 'tests.example_app')
      pale_flask_adapter.bind_blueprint(api, blueprint)
  
      app = flask.Flask(__name__)
      app.register_blueprint(blueprint, url_prefix='/api')
  
      return app
  
Add authenticator and context creator to example app
## Code Before:
import flask

from pale.adapters import flask as pale_flask_adapter

from tests.example_app import api


def create_pale_flask_app():
    """Creates a flask app, and registers a blueprint bound to pale."""
    blueprint = flask.Blueprint('api', 'tests.example_app')
    pale_flask_adapter.bind_blueprint(api, blueprint)

    app = flask.Flask(__name__)
    app.register_blueprint(blueprint, url_prefix='/api')

    return app

## Instruction:
Add authenticator and context creator to example app
## Code After:
import flask

from pale.adapters import flask as pale_flask_adapter
from pale.config import authenticator, context_creator

from tests.example_app import api


@authenticator
def authenticate_pale_context(context):
    """Don't actually authenticate anything in this test."""
    return context

@context_creator
def create_pale_context(endpoint,request):
    return pale_flask_adapter.DefaultFlaskContext(endpoint, request)


def create_pale_flask_app():
    """Creates a flask app, and registers a blueprint bound to pale."""
    blueprint = flask.Blueprint('api', 'tests.example_app')
    pale_flask_adapter.bind_blueprint(api, blueprint)

    app = flask.Flask(__name__)
    app.register_blueprint(blueprint, url_prefix='/api')

    return app
