File: test_misc.py

package info (click to toggle)
python-falcon 4.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,172 kB
  • sloc: python: 33,608; javascript: 92; sh: 50; makefile: 50
file content (29 lines) | stat: -rw-r--r-- 779 bytes parent folder | download
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
# misc test for 100% coverage

from unittest.mock import MagicMock

import pytest

from falcon.asgi import App
from falcon.http_error import HTTPError
from falcon.http_status import HTTPStatus


async def test_http_status_not_impl():
    app = App()
    with pytest.raises(NotImplementedError):
        await app._http_status_handler(MagicMock(), None, HTTPStatus(200), {}, None)


async def test_http_error_not_impl():
    app = App()
    with pytest.raises(NotImplementedError):
        await app._http_error_handler(MagicMock(), None, HTTPError(400), {}, None)


async def test_python_error_not_impl():
    app = App()
    with pytest.raises(NotImplementedError):
        await app._python_error_handler(
            MagicMock(), None, ValueError('error'), {}, None
        )