forked from ETF/media_frenzy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_user_db.py
32 lines (25 loc) · 935 Bytes
/
test_user_db.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
#224 of 439
import os
import unittest
from mf_app import app, db
from mf_app.models import User
from config import basedir
TEST_DB = 'thetest.db'
class AddUser(unittest.TestCase):
def setUp(self):
app.config['TESTING'] = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(basedir, TEST_DB)
self.app = app.test_client()
db.create_all()
#def tearDown(self):
#db.drop_all()
''' def test_user_setup(self):
#def __init__(self, username=None, email=None, password=None, creation_date=None, updated_date=None, lost_password_key=None):
new_user = User('validlength','[email protected]', 'validpasslength', 'lost_password_key')
new_user2 = User('validlength2','[email protected]', 'validpasslength2', 'lost_password_key2')
db.session.add(new_user, new_user2)
db.session.commit()
test = db.session.query(User).all()
assert 'validlength' in test
if __name__ == '__main__':
unittest.main()'''