File: test_happy_birthday.py

package info (click to toggle)
python-hug 2.6.0-2.4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,072 kB
  • sloc: python: 8,938; sh: 99; makefile: 17
file content (18 lines) | stat: -rw-r--r-- 617 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import hug
import happy_birthday
from falcon import HTTP_400, HTTP_404, HTTP_200


def tests_happy_birthday():
    response = hug.test.get(happy_birthday, "happy_birthday", {"name": "Timothy", "age": 25})
    assert response.status == HTTP_200
    assert response.data is not None


def tests_season_greetings():
    response = hug.test.get(happy_birthday, "greet/Christmas")
    assert response.status == HTTP_200
    assert response.data is not None
    assert str(response.data) == "Merry Christmas!"
    response = hug.test.get(happy_birthday, "greet/holidays")
    assert str(response.data) == "Happy holidays!"