def test_static_with_invalid_path(self): environ = {'PATH_INFO': '/'} with test.support.change_cwd(self.temp_dir): body = manifest.static(environ, self._start_response) self.assertEqual(body[0], b'404 Not Found') self.assertEqual(self._last_status, '404 Not Found') headers = dict(self._last_headers) self.assertEqual(headers['Content-Type'], 'text/plain')
def test_static(self): environ = {'PATH_INFO': '/static/ham.ipa'} with test.support.change_cwd(self.temp_dir): body = manifest.static(environ, self._start_response) self.assertEqual(len(body[0]), 292) self.assertEqual(self._last_status, '200 OK') headers = dict(self._last_headers) self.assertEqual(headers['Content-Type'], 'application/octet-stream')