def setUpClass(self):
     self.app = create_app(testing=True)
     self.app_context = self.app.app_context()
     self.app_context.push()
     self.client = self.app.test_client()
     
     #Create a brand new test db
     db.create_all()
     
     LOG.info("Initializing tests.")
     
     new_user = User("admin", "adminpassword")
     db.session.add(new_user)
     
     new_normal_user = User("normaluser", "password")
     db.session.add(new_normal_user)
     
     new_normal_user2 = User("normaluser2", "password")
     db.session.add(new_normal_user2)
     
     try:
         db.session.commit()
     except Exception as e:
         LOG.error(e, exc_info=True)
     
     new_session = Session(new_normal_user)
     self.mysessionid = new_session.id
     db.session.add(new_session)
     
     try:
         db.session.commit()
     except Exception as e:
         LOG.error(e, exc_info=True)
     
     new_session_todelete = Session(new_normal_user2)
     self.mysessionid_todelete = new_session_todelete.id
     db.session.add(new_session_todelete)
    def setUpClass(self):
        self.app = create_app(testing=True)
        self.app_context = self.app.app_context()
        self.app_context.push()
        self.client = self.app.test_client()

        #Create a brand new test db
        db.create_all()

        LOG.info("Initializing tests.")

        new_user = User("admin", "adminpassword")
        db.session.add(new_user)

        new_normal_user = User("normaluser", "password")
        db.session.add(new_normal_user)

        new_normal_user2 = User("normaluser2", "password")
        db.session.add(new_normal_user2)

        try:
            db.session.commit()
        except Exception as e:
            LOG.error(e, exc_info=True)

        new_session = Session(new_normal_user)
        self.mysessionid = new_session.id
        db.session.add(new_session)

        try:
            db.session.commit()
        except Exception as e:
            LOG.error(e, exc_info=True)

        new_session_todelete = Session(new_normal_user2)
        self.mysessionid_todelete = new_session_todelete.id
        db.session.add(new_session_todelete)
 def tearDownClass(self):
     LOG.info("======================Finished tests====================")
     db.session.remove()
     db.drop_all()
     self.app_context.pop()
 def tearDownClass(self):
     LOG.info("======================Finished tests====================")
     db.session.remove()
     db.drop_all()
     self.app_context.pop()