You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
467 B
Python
21 lines
467 B
Python
from apistar.test import TestClient
|
|
from app import welcome
|
|
|
|
|
|
def test_welcome():
|
|
"""
|
|
Testing a view directly.
|
|
"""
|
|
data = welcome()
|
|
assert data == {'message': 'Welcome to API Star!'}
|
|
|
|
|
|
def test_http_request():
|
|
"""
|
|
Testing a view, using the test client.
|
|
"""
|
|
client = TestClient()
|
|
response = client.get('http://localhost/')
|
|
assert response.status_code == 200
|
|
assert response.json() == {'message': 'Welcome to API Star!'}
|