Browse Source

add test_routes.py

feature_tests
Burathar 4 years ago
parent
commit
ed91907656
  1. 34
      tests/test_routes.py

34
tests/test_routes.py

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
import unittest
from app import create_app, db
from app.models import Player, Game, Role, GamePlayer, Objective, ObjectiveMinimalEncoder, LocationEncoder
from config import Config
class TestConfig(Config):
TESTING = True
SQLALCHEMY_DATABASE_URI = 'sqlite://'
class RoutesCase(unittest.TestCase):
def setUp(self):
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_is_game_owner(self):
g = Game(name='TestGame')
p1 = Player(name='Henk')
p2 = Player(name='Alfred')
g.players.append(p1)
g.players.append(p2)
db.session.append(g)
db.session.commit()
self.assertEqual
self.assertFalse('Foo'.isupper())
if __name__ == '__main__':
unittest.main(verbosity=2)
Loading…
Cancel
Save