# Path: flask_editablesite/app.py
# def create_app(config_object=ProdConfig):
#     """An application factory, as explained here:
#         http://flask.pocoo.org/docs/patterns/appfactories/
# 
#     :param config_object: The configuration object to use.
#     """
#     app = Flask(__name__)
#     app.config.from_object(config_object)
#     register_loggers(app)
#     register_extensions(app)
#     register_blueprints(app)
#     register_errorhandlers(app)
#     return app
# 
# Path: flask_editablesite/settings.py
# class TestConfig(Config):
#     TESTING = True
#     DEBUG = True
#     BCRYPT_LOG_ROUNDS = 1  # For faster tests
#     WTF_CSRF_ENABLED = False  # Allows form testing
# 
# Path: flask_editablesite/editable/sample_text.py
# def placeholder_or_random_sample_text():
#     """
#     Gets a random sample chunk of text if possible, otherwise the
#     default placeholder text.
#     """
# 
#     is_sample_text_configured = (
#         app.config.get('EDITABLE_SAMPLE_TEXT_SCRAPE_URLS') and
#         True or False)
# 
#     return (is_sample_text_configured
#             and random_sample_text()
#             or app.config['EDITABLE_PLACEHOLDER_TEXT'])


from flask_editablesite.app import create_app
from flask_editablesite.settings import TestConfig
from flask_editablesite.editable.sample_text import (
    placeholder_or_random_sample_text,)
# -*- coding: utf-8 -*-
"""Test the sample text generation."""





def test_placeholder_when_no_scrape_configured(app):
    sample_text = placeholder_or_random_sample_text()
    assert sample_text == app.config['EDITABLE_PLACEHOLDER_TEXT']


class TextScrapeTestConfig(TestConfig):
    EDITABLE_SAMPLE_TEXT_SCRAPE_URLS = [
        (
            'https://raw.githubusercontent.com'
            '/Jaza/flask-editablesite'
            '/master/tests/sample-text-great-expectations.txt'), ]


def test_markovify_when_scrape_configured():
    app = create_app(TextScrapeTestConfig)

    with app.app_context():

# Path: flask_editablesite/app.py
# def create_app(config_object=ProdConfig):
#     """An application factory, as explained here:
#         http://flask.pocoo.org/docs/patterns/appfactories/
# 
#     :param config_object: The configuration object to use.
#     """
#     app = Flask(__name__)
#     app.config.from_object(config_object)
#     register_loggers(app)
#     register_extensions(app)
#     register_blueprints(app)
#     register_errorhandlers(app)
#     return app
# 
# Path: flask_editablesite/settings.py
# class TestConfig(Config):
#     TESTING = True
#     DEBUG = True
#     BCRYPT_LOG_ROUNDS = 1  # For faster tests
#     WTF_CSRF_ENABLED = False  # Allows form testing
# 
# Path: flask_editablesite/editable/sample_text.py
# def placeholder_or_random_sample_text():
#     """
#     Gets a random sample chunk of text if possible, otherwise the
#     default placeholder text.
#     """
# 
#     is_sample_text_configured = (
#         app.config.get('EDITABLE_SAMPLE_TEXT_SCRAPE_URLS') and
#         True or False)
# 
#     return (is_sample_text_configured
#             and random_sample_text()
#             or app.config['EDITABLE_PLACEHOLDER_TEXT'])


# Path: tests/test_sample_text.py
from flask_editablesite.app import create_app
from flask_editablesite.settings import TestConfig
from flask_editablesite.editable.sample_text import (
    placeholder_or_random_sample_text,)

# -*- coding: utf-8 -*-
"""Test the sample text generation."""





def test_placeholder_when_no_scrape_configured(app):
    sample_text = placeholder_or_random_sample_text()
    assert sample_text == app.config['EDITABLE_PLACEHOLDER_TEXT']


class TextScrapeTestConfig(TestConfig):
    EDITABLE_SAMPLE_TEXT_SCRAPE_URLS = [
        (
            'https://raw.githubusercontent.com'
            '/Jaza/flask-editablesite'
            '/master/tests/sample-text-great-expectations.txt'), ]


def test_markovify_when_scrape_configured():
    app = create_app(TextScrapeTestConfig)

    with app.app_context():

        sample_text = placeholder_or_random_sample_text()