diff --git a/locust/test/testcases.py b/locust/test/testcases.py index adfbffcdc6..83ea465e93 100644 --- a/locust/test/testcases.py +++ b/locust/test/testcases.py @@ -15,7 +15,7 @@ def safe_repr(obj, short=False): """ - Function from python 2.7's unittest.util. Used in methods that is copied + Function from python 2.7's unittest.util. Used in methods that is copied from 2.7's unittest.TestCase to work in python 2.6. """ _MAX_LENGTH = 80 @@ -90,7 +90,8 @@ def basic_auth(): @app.route("/no_content_length") def no_content_length(): - r = send_file(BytesIO("This response does not have content-length in the header".encode('utf-8')), add_etags=False) + r = send_file(BytesIO("This response does not have content-length in the header".encode('utf-8')), mimetype="application/octet-stream", + add_etags=False) return r @app.errorhandler(404) @@ -123,11 +124,11 @@ def setUp(self): event = getattr(events, name) if isinstance(event, events.EventHook): self._event_handlers[event] = copy(event._handlers) - + def tearDown(self): for event, handlers in six.iteritems(self._event_handlers): event._handlers = handlers - + def assertIn(self, member, container, msg=None): """ Just like self.assertTrue(a in b), but with a nicer default message. @@ -137,7 +138,7 @@ def assertIn(self, member, container, msg=None): standardMsg = '%s not found in %s' % (safe_repr(member), safe_repr(container)) self.fail(self._formatMessage(msg, standardMsg)) - + def assertLess(self, a, b, msg=None): """Just like self.assertTrue(a < b), but with a nicer default message.""" if not a < b: @@ -162,7 +163,7 @@ def assertGreaterEqual(self, a, b, msg=None): standardMsg = '%s not greater than or equal to %s' % (safe_repr(a), safe_repr(b)) self.fail(self._formatMessage(msg, standardMsg)) - + class WebserverTestCase(LocustTestCase): """ Test case class that sets up an HTTP server which can be used within the tests