def setup_method(self, method):
        self.app = app.test_client()
        app.jinja_env.lstrip_blocks = True
        app.jinja_env.trim_blocks = True

        app.config['WTF_CSRF_ENABLED'] = False
 def setUp(self):
     self.app = app.test_client()
from unittest import mock
import logging
import json
from freezegun import freeze_time
from digital_street_3d_ui.main import app
from digital_street_3d_ui.custom_extensions.enhanced_logging.main import EnhancedLogging
from werkzeug import Headers

logger = logging.getLogger('digital-street-3d-ui')
client = app.test_client()


def parse_log_output(capmanager):
    # Suppress stdout/stderr and capture the contents
    capmanager.suspend_global_capture()
    out, err = capmanager.read_global_capture()
    capmanager.resume_global_capture()

    # Try and parse it as json
    try:
        return json.loads(out)
    except ValueError as e:
        # If we can't parse it, print a useful err to allow people to debug it.
        # The default ValueError is particularly unhelpful in actually diagnosing the problem
        # Re-print the stdout and stderr because capturing it above suppresses it
        print(out)
        print(err)
        raise Exception("Error parsing log output as JSON.\nCaptured stdout was:"
                        "\n\n-------\n{}------\n\n"
                        "Captured stderr was:"
                        "\n-------\n{}-------".format(out, err)) from e
Beispiel #4
0
 def setup_method(self, method):
     self.app = app.test_client()
 def setUp(self):
     self.client = app.test_client()
     app.config['WTF_CSRF_ENABLED'] = False