You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
|
|
import unittest
|
|
|
|
from app import create_app, db
|
|
|
|
from app.models import User, Game, Role, GamePlayer, Objective, ObjectiveEncoder, LocationEncoder
|
|
|
|
import app.main.routes as routes
|
|
|
|
from config import Config
|
|
|
|
|
|
|
|
class TestConfig(Config):
|
|
|
|
TESTING = True
|
|
|
|
WTF_CSRF_ENABLED = False
|
|
|
|
DEBUG = False
|
|
|
|
SQLALCHEMY_DATABASE_URI = 'sqlite://'
|
|
|
|
|
|
|
|
class RoutesCase(unittest.TestCase):
|
|
|
|
# implement this: https://stackoverflow.com/questions/47294304/how-to-mock-current-user-in-flask-templates
|
|
|
|
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()
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main(verbosity=2)
|