-
Notifications
You must be signed in to change notification settings - Fork 2
/
tests.py
38 lines (26 loc) · 970 Bytes
/
tests.py
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
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
"""Test UW Menu Flask application."""
import json
import unittest
from uwmenu import app, attach_filters
class UWMenuTestCase(unittest.TestCase):
def setUp(self):
attach_filters()
app.config['TESTING'] = True
self.app = app.test_client()
def tearDown(self):
pass
def test_menu_pageload(self):
"""Ensure description on menu page is present."""
rv = self.app.get('/')
assert b'Weekly menus for the University of Waterloo\'s on-campus eateries.' in rv.data
def test_about_pageload(self):
"""Ensure attribution on about page is present."""
rv = self.app.get('/')
assert b'This is an open source application available on GitHub' in rv.data
def test_api_endpoint(self):
"""Ensure API endpoint returns valid JSON."""
rv = self.app.get('/menu/')
assert json.loads(rv.data)
if __name__ == "__main__":
unittest.main()