kopia lustrzana https://github.com/snarfed/bridgy-fed
updates for appengine_info changes, LOCAL => LOCAL_SERVER etc
snarfed/webutil@722053854a through snarfed/webutil@86d89bd3dfpull/634/head
rodzic
f116dbfa26
commit
0bb1038c3a
|
|
@ -2,6 +2,7 @@
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
|
|
||||||
from flask import Flask, g
|
from flask import Flask, g
|
||||||
from flask_caching import Cache
|
from flask_caching import Cache
|
||||||
|
|
@ -31,7 +32,9 @@ app.config.from_pyfile(app_dir / 'config.py')
|
||||||
app.url_map.converters['regex'] = flask_util.RegexConverter
|
app.url_map.converters['regex'] = flask_util.RegexConverter
|
||||||
app.after_request(flask_util.default_modern_headers)
|
app.after_request(flask_util.default_modern_headers)
|
||||||
app.register_error_handler(Exception, flask_util.handle_exception)
|
app.register_error_handler(Exception, flask_util.handle_exception)
|
||||||
if appengine_info.LOCAL:
|
if (appengine_info.LOCAL_SERVER
|
||||||
|
# ugly hack to infer if we're running unit tests
|
||||||
|
and 'unittest' not in sys.modules):
|
||||||
flask_gae_static.init_app(app)
|
flask_gae_static.init_app(app)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ from granary.tests.test_as1 import (
|
||||||
)
|
)
|
||||||
from oauth_dropins.webutil import testutil, util
|
from oauth_dropins.webutil import testutil, util
|
||||||
from oauth_dropins.webutil.appengine_config import ndb_client
|
from oauth_dropins.webutil.appengine_config import ndb_client
|
||||||
|
from oauth_dropins.webutil import appengine_info
|
||||||
from oauth_dropins.webutil.testutil import requests_response
|
from oauth_dropins.webutil.testutil import requests_response
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
@ -157,6 +158,7 @@ class TestCase(unittest.TestCase, testutil.Asserts):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
|
|
||||||
|
appengine_info.LOCAL_SERVER = False
|
||||||
app.testing = True
|
app.testing = True
|
||||||
cache.clear()
|
cache.clear()
|
||||||
protocol.seen_ids.clear()
|
protocol.seen_ids.clear()
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue