def setUp(self): self.client = app.test_client()
import json import logging from unittest import mock from werkzeug import Headers from freezegun import freeze_time from payment.custom_extensions.enhanced_logging.main import EnhancedLogging from payment.main import app logger = logging.getLogger('payment-ui') client = app.test_client() def parse_log_output(capmanager): # Suppress stdout/stderr and capture the contents out, err = capmanager.suspend_global_capture(in_=True) capmanager.resume_global_capture() # Try and parse it as json try: return json.loads(out) except ValueError: # 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:"
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_method(self, method): self.app = app.test_client()