(self)
| 159 | ) |
| 160 | |
| 161 | def test_status_validation_errors(self): |
| 162 | def create_bad_app(status): |
| 163 | def bad_app(environ, start_response): |
| 164 | start_response(status, [("Content-Type", "text/plain; charset=utf-8")]) |
| 165 | return [b"Hello, world!"] |
| 166 | return bad_app |
| 167 | |
| 168 | tests = [ |
| 169 | ('200', 'AssertionError: Status must be at least 4 characters'), |
| 170 | ('20X OK', 'AssertionError: Status message must begin w/3-digit code'), |
| 171 | ('200OK', 'AssertionError: Status message must have a space after code'), |
| 172 | ] |
| 173 | |
| 174 | for status, exc_message in tests: |
| 175 | with self.subTest(status=status): |
| 176 | out, err = run_amock(create_bad_app(status)) |
| 177 | self.assertEndsWith(out, |
| 178 | b"A server error occurred. Please contact the administrator." |
| 179 | ) |
| 180 | self.assertEqual(err.splitlines()[-2], exc_message) |
| 181 | |
| 182 | def test_wsgi_input(self): |
| 183 | def bad_app(e,s): |
nothing calls this directly
no test coverage detected