Skip to content

Commit 8fc5607

Browse files
committed
make the generic WSGI handling setup code more uniform
1 parent 7de1564 commit 8fc5607

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

tests/support/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
from tests.support.loggersupp import FakeLogger
7272
from tests.support.serversupp import make_wrapped_server
7373
from tests.support.wsgisupp import create_wsgi_environ, \
74-
ServerAssertMixin, FakeStartResponse
74+
create_wsgi_start_response, ServerAssertMixin
7575

7676

7777
# Basic global logging configuration for testing

tests/support/wsgisupp.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ def __call__(self, status, headers, exc=None):
4646
self.calls.append((status, headers, exc))
4747

4848

49+
def create_wsgi_start_response():
50+
return FakeStartResponse()
51+
52+
4953
class ServerAssertMixin:
5054
"""Custom assertions for verifying server code executed under test."""
5155

tests/test_mig_wsgi-bin_migwsgi.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939

4040

4141
from tests.support import PY2, is_path_within, \
42-
create_wsgi_environ, ServerAssertMixin, FakeStartResponse, HtmlAssertMixin
42+
create_wsgi_environ, create_wsgi_start_response, \
43+
ServerAssertMixin, HtmlAssertMixin
4344
from mig.shared.base import client_id_dir, client_dir_id, get_short_id, \
4445
invisible_path, allow_script, brief_list
4546

@@ -200,17 +201,18 @@ def before_each(self):
200201
config = _assert_local_config()
201202
config_global_values = _assert_local_config_global_values(config)
202203

203-
self.fake_start_response = FakeStartResponse()
204-
205-
fake_wsgi_environ = create_wsgi_environ(_TEST_CONF_FILE, wsgi_variables=dict(
204+
# generic WSGI setup
205+
self.fake_wsgi_environ = create_wsgi_environ(_TEST_CONF_FILE, wsgi_variables=dict(
206206
http_host='localhost',
207207
path_info='/',
208208
))
209+
self.fake_start_response = create_wsgi_start_response()
209210

211+
# MiG WSGI wrapper specific setup
210212
self.instrumented_format_output = create_instrumented_format_output()
211213
self.instrumented_retrieve_handler = create_instrumented_retrieve_handler()
212214

213-
self.application_args = (fake_wsgi_environ, self.fake_start_response,)
215+
self.application_args = (self.fake_wsgi_environ, self.fake_start_response,)
214216
self.application_kwargs = dict(
215217
_wrap_wsgi_errors=noop,
216218
_config_file=_TEST_CONF_FILE,

0 commit comments

Comments
 (0)