-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit a698ef651890665060ce76b61aab42511a008b26 Author: Maximiliano Osorio <maxiosorio@gmail.com> Date: Thu Apr 23 08:20:11 2020 -0700 fix: removing config options commit 7954ec630ab3826a052486adf73ada2e1791e736 Author: Maximiliano Osorio <maxiosorio@gmail.com> Date: Thu Apr 23 08:17:49 2020 -0700 test
- Loading branch information
Showing
2 changed files
with
13 additions
and
59 deletions.
There are no files selected for viewing
68 changes: 11 additions & 57 deletions
68
src/main/resources/servers/python/.openapi-generator/template/__init__test.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,28 @@ | ||
import logging | ||
|
||
import connexion | ||
from connexion.spec import Specification | ||
from flask_testing import TestCase | ||
from obasparql import QueryManager | ||
|
||
from {{packageName}}.encoder import JSONEncoder | ||
from {{packageName}}.cached import CachedSpecification | ||
from {{packageName}} import QUERY_DIRECTORY, CONTEXT_DIRECTORY, QUERIES_TYPES | ||
|
||
query_manager = QueryManager(queries_dir=QUERY_DIRECTORY, | ||
context_dir=CONTEXT_DIRECTORY, | ||
queries_types=QUERIES_TYPES) | ||
from {{packageName}}.encoder import JSONEncoder | ||
|
||
import logging.config | ||
import os | ||
|
||
# Disable Django's logging setup | ||
LOGGING_CONFIG = None | ||
|
||
LOGLEVEL = os.environ.get('LOGLEVEL', 'info').upper() | ||
|
||
logging.config.dictConfig({ | ||
'version': 1, | ||
'disable_existing_loggers': False, | ||
'formatters': { | ||
'default': { | ||
# exact format is not important, this is the minimum information | ||
'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s', | ||
}, | ||
}, | ||
'handlers': { | ||
# console logs to stderr | ||
'console': { | ||
'class': 'logging.StreamHandler', | ||
'formatter': 'default', | ||
}, | ||
}, | ||
'loggers': { | ||
# default for all undefined Python modules | ||
'': { | ||
'level': 'WARNING', | ||
'handlers': ['console'], | ||
}, | ||
# Our application code | ||
'openapi_server': { | ||
'level': LOGLEVEL, | ||
'handlers': ['console'], | ||
# Avoid double logging because of root logger | ||
'propagate': False, | ||
}, | ||
# Prevent noisy modules from logging to Sentry | ||
'noisy_module': { | ||
'level': 'ERROR', | ||
'handlers': ['console'], | ||
'propagate': False, | ||
}, | ||
}, | ||
}) | ||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class BaseTestCase(TestCase): | ||
logging_file = Path(__file__).parent.parent / "settings" / "logging.ini" | ||
try: | ||
logging.config.fileConfig(logging_file) | ||
except: | ||
logging.error("Logging config file does not exist {}".format(logging_file)) | ||
exit(0) | ||
logger = logging.getLogger(__name__) | ||
|
||
def create_app(self): | ||
logging.getLogger('connexion.operation').setLevel('ERROR') | ||
Specification.from_file = CachedSpecification.from_file | ||
app = connexion.App(__name__, specification_dir='../openapi/') | ||
app.app.json_encoder = JSONEncoder | ||
app.add_api('openapi.yaml', | ||
app.add_api('openapi.yaml', | ||
pythonic_params=True, | ||
pythonic_params=False, | ||
strict_validation=True) | ||
validate_responses=True) | ||
return app.app |
4 changes: 2 additions & 2 deletions
4
...ain/resources/servers/python/.openapi-generator/template/static_files/settings/config.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[defaults] | ||
endpoint = http://dbpedia.org/sparql | ||
endpoint = | ||
queries_dir = queries/ | ||
context_dir = contexts/ | ||
prefix = http://dbpedia.org/resource | ||
prefix = | ||
graph_base = |