mirror of
https://github.com/LukeHagar/connexion.git
synced 2025-12-10 12:27:46 +00:00
Fixes the build. Changes proposed in this pull request: - apply all of the isort changes that resulted from the latest version - pin to the latest version (4.3.15) so this doesn't happen again, unless we bump the version on purpose
24 lines
735 B
Python
24 lines
735 B
Python
import json
|
|
|
|
import flask
|
|
from mock import MagicMock
|
|
|
|
import connexion
|
|
from connexion.decorators.metrics import UWSGIMetricsCollector
|
|
|
|
|
|
def test_timer(monkeypatch):
|
|
wrapper = UWSGIMetricsCollector('/foo/bar/<param>', 'get')
|
|
|
|
def operation(req):
|
|
return connexion.problem(418, '', '')
|
|
|
|
op = wrapper(operation)
|
|
metrics = MagicMock()
|
|
monkeypatch.setattr('flask.request', MagicMock())
|
|
monkeypatch.setattr('flask.current_app', MagicMock(response_class=flask.Response))
|
|
monkeypatch.setattr('connexion.decorators.metrics.uwsgi_metrics', metrics)
|
|
op(MagicMock())
|
|
assert metrics.timer.call_args[0][:2] == ('connexion.response',
|
|
'418.GET.foo.bar.{param}')
|