-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.py
More file actions
41 lines (28 loc) · 965 Bytes
/
tests.py
File metadata and controls
41 lines (28 loc) · 965 Bytes
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
from datetime import datetime, timedelta
import unittest
from app.app import create_app
from app.extensions import db
from app.models import User, Post
from config.setting import Config
class TestConfig(Config):
TESTING = True
DEBUG = False
SQLALCHEMY_DATABASE_URI = 'sqlite://'
class UserModelCase(unittest.TestCase):
def setUp(self):
self.app = create_app(TestConfig)
self.app_context = self.app.app_context()
self.app_context.push()
db.create_all()
print("-------------done set up----------")
def tearDown(self):
db.session.remove()
db.drop_all()
self.app_context.pop()
def test_password_hashing(self):
u = User(username='susan',password='cat', email='susan@gmail')
self.assertFalse(u.check_password('dog'))
self.assertTrue(u.check_password('cat'))
if __name__ == '__main__':
print("hello")
unittest.main(verbosity=2)