File: test_asgi_http.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 (16 lines) | stat: -rw-r--r-- 503 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from pathlib import Path


def test_hello_http_call(client):
    response = client.simulate_get('/hello')
    assert response.status_code == 200
    data = response.json
    assert data == {'hello': 'world'}


def test_fallback(client):
    response = client.simulate_get('/missing')
    assert response.status_code == 200
    assert response.headers['Content-Type'] == 'text/html'
    index = Path(__file__).parent.parent / 'ws_tutorial/static/index.html'
    assert response.text == index.read_text()