Burathar
5 years ago
1 changed files with 34 additions and 0 deletions
@ -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…
Reference in new issue