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)
Exemple #3
0
'''
Run the application
'''

import os
import sys

sys.path.append(os.path.dirname(__name__))

#from sample_application import create_app
from userprofile_app import create_app

# create an app instance
app = create_app()

app.run(debug=True, port=5002)
import sys, os
INTERP = os.path.join(os.environ['HOME'], '.virtualenvs', 'env', 'bin', 'python')
print(INTERP)
if sys.executable != INTERP:
	os.execl(INTERP, INTERP, *sys.argv)

current_dir = os.getcwd()
app_dir = os.path.join(current_dir, 'userprofile')
#sys.path.append(os.getcwd())
sys.path.append(app_dir)


from userprofile_app import create_app

application = create_app()



# Uncomment next two lines to enable debugging
#from werkzeug.debug import DebuggedApplication
#application = DebuggedApplication(application, evalex=True)

#from flask import Flask
#application = Flask(__name__)

#@application.route('/')
#def index():
#	return 'Hello passenger'