-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.py
44 lines (36 loc) · 1.22 KB
/
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
39
40
41
42
43
44
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Run the entire test suite with
# the following command
# (venv) $ python tests.py
from datetime import datetime, timedelta
import unittest
from app import app, db
from app.models import User
from app.mainapp import MainApp
class UserModelCase(unittest.TestCase):
def setUp(self):
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://'
db.create_all()
def tearDown(self):
db.session.remove()
db.drop_all()
def test_password_hashing(self):
u = User(username='susan')
u.set_password('cat')
self.assertFalse(u.check_password('dog'))
self.assertTrue(u.check_password('cat'))
class MainAppCase(unittest.TestCase):
def test_has_message(self):
# message = 'fkijdff'
# message = "Hello, World!"
# letters = 'cvjolalgnfkdbooaslldfgDFGDFglsidjfokasdf'
# letters = 'fkijdff'
# letters = 'startHelloWorldfoospamh'
message = "HelloWorldHH"
letters = 'startHeoWordfoospamHh'
cooking = MainApp(message, letters)
# self.assertTrue(cooking.has_message())
self.assertFalse(cooking.has_message())
if __name__ == '__main__':
unittest.main(verbosity=2)