def setUp(self): self.db_fd, app.config['DATABASE'] = tempfile.mkstemp() app.config['TESTING'] = True self.app = app.test_client() with app.test_request_context(): g.connection = connect_db() g.db = g.connection['game']['games'] init_db()
def test_new_game_id(self): "Creating a new game should change the session id" self.app2 = app.test_client() id_1, id_2 = 0, 0 with self.app as test: test.get('/') id_1 = session['id'] with self.app2 as test: test.get('/') id_2 = session['id'] self.assertNotEqual(id_1, id_2)