diff --git a/tests/test_tornado_json.py b/tests/test_tornado_json.py index a36b7b4..6b3ec47 100644 --- a/tests/test_tornado_json.py +++ b/tests/test_tornado_json.py @@ -170,6 +170,9 @@ class MockJSendMixinRH(jsend.JSendMixin): def write(self, data): self._buffer = data + def finish(self): + pass + @classmethod @pytest.fixture(scope="class", autouse=True) def setup(cls): diff --git a/tornado_json/jsend.py b/tornado_json/jsend.py index dd240fa..ca608c1 100644 --- a/tornado_json/jsend.py +++ b/tornado_json/jsend.py @@ -19,6 +19,7 @@ def success(self, data): call. If the call returns no data, data should be set to null. """ self.write({'status': 'success', 'data': data}) + self.finish() def fail(self, data): """There was a problem with the data submitted, or some pre-condition @@ -30,6 +31,7 @@ def fail(self, data): the response object's keys SHOULD correspond to those POST values. """ self.write({'status': 'fail', 'data': data}) + self.finish() def error(self, message, data=None, code=None): """An error occurred in processing the request, i.e. an exception was @@ -51,3 +53,4 @@ def error(self, message, data=None, code=None): if code: result['code'] = code self.write(result) + self.finish()