/usr/lib/python3/dist-packages/pydap/tests/test_responses_error.py is in python3-pydap 3.2.2+ds1-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | import sys
from webob import Request
from pydap.responses.error import ErrorResponse
from pydap.lib import __version__
import unittest
class TestErrorResponse(unittest.TestCase):
def setUp(self):
# create an exception that would happen in runtime
try:
1/0
except:
error = ErrorResponse(sys.exc_info())
req = Request.blank('/')
self.res = req.get_response(error)
def test_status(self):
self.assertEqual(self.res.status, "500 Internal Error")
def test_content_type(self):
self.assertEqual(self.res.content_type, "text/plain")
def test_charset(self):
self.assertEqual(self.res.charset, "utf-8")
def test_headers(self):
self.assertEqual(self.res.headers['Content-Type'],
'text/plain; charset=utf-8')
self.assertEqual(self.res.headers['Content-description'], 'dods_error')
self.assertEqual(self.res.headers['XDODS-Server'],
'pydap/' + __version__)
def test_body(self):
self.assertRegexpMatches(self.res.text, r"""Error {
code = -1;
message = "Traceback \(most recent call last\):
File .*
1/0
ZeroDivisionError:( integer)? division( or modulo)? by zero
";
}""")
|