Skip to content

Commit

Permalink
fix : tests.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ssurbhi560 committed Sep 8, 2021
1 parent e297ac8 commit 8ff63f4
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
from datetime import datetime, timedelta
import unittest
from app import app, db
from app import create_app, db
from app.models import User, Post
from config import Config


class TestConfig(Config):
TESTING = True
SQLALCHEMY_DATABASE_URI = 'sqlite://'


class UserModelCase(unittest.TestCase):

def setUp(self):
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://'
self.app = create_app(TestConfig)
self.app_context = self.app.app_context()
self.app_context.push()
db.create_all()

def tearDown(self):
db.session.remove()
db.drop_all()

self.app_context.pop()

def test_password_hashing(self):
u = User(username='susan')
u.set_password('cat')
Expand Down Expand Up @@ -89,5 +96,6 @@ def test_follow_posts(self):
self.assertEqual(f3, [p3, p4])
self.assertEqual(f4, [p4])


if __name__ == '__main__':
unittest.main(verbosity=2)

0 comments on commit 8ff63f4

Please sign in to comment.