-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_basic.py
59 lines (45 loc) · 1.74 KB
/
test_basic.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import os
import unittest
from app import app, db
TEST_DB = 'test.db'
'''
To run tests on local machine, run "python -m unittest discover" at the root directory
'''
class BasicTests(unittest.TestCase):
def setup(self):
app.config['TESTING'] = True
app.config['WTF_CSRF_ENABLED'] = False
app.config['DEBUG'] = False
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + \
os.path.join(app.config['BASEDIR'], TEST_DB)
self.app = app.test_client()
db.drop_all()
db.create_all()
# Disable sending emails during unit testing
#mail.init_app(app)
self.assertEqual(app.debug, False)
# executed after each test
def tearDown(self):
pass
def test_main_page(self):
self.app = app.test_client()
response = self.app.get('/', follow_redirects=True)
self.assertEqual(response.status_code, 200)
def test_projects_page(self):
self.app = app.test_client()
response = self.app.get('/projects', follow_redirects=True)
self.assertEqual(response.status_code, 200)
def test_our_team_page(self):
self.app = app.test_client()
response = self.app.get('/our_team', follow_redirects=True)
self.assertEqual(response.status_code, 200)
def test_contact_page(self):
self.app = app.test_client()
response = self.app.get('/contact_us', follow_redirects=True)
self.assertEqual(response.status_code, 200)
def test_events_page(self):
self.app = app.test_client()
response = self.app.get('/events', follow_redirects=True)
self.assertEqual(response.status_code, 200)
def test_sanity(self):
self.assertEqual(1, 1)