From ed919076560a783a90c14d536182928ea9b6a553 Mon Sep 17 00:00:00 2001 From: Burathar Date: Wed, 15 Jul 2020 21:51:34 +0200 Subject: [PATCH] add test_routes.py --- tests/test_routes.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/test_routes.py diff --git a/tests/test_routes.py b/tests/test_routes.py new file mode 100644 index 0000000..a498db9 --- /dev/null +++ b/tests/test_routes.py @@ -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) \ No newline at end of file