def setUp(self):
     bucketlist_app = create_app('instance.config.TestingConfig')
     self.user_data = {'username': '******', 'password': '******'}
     self.app = bucketlist_app
     self.client = bucketlist_app.test_client
     with bucketlist_app.app_context():
         db.create_all()
         user = User(**self.user_data)
         user.save()
示例#2
0
 def setUp(self):
     bucketlist_app = create_app('instance.config.TestingConfig')
     self.user_data = {'username': '******', 'password': '******'}
     self.app = bucketlist_app
     self.client = bucketlist_app.test_client
     with bucketlist_app.app_context():
         db.create_all()
         user = User(**self.user_data)
         user.save()
示例#3
0
def createdb(testdata=False):
    """Initializes the database"""
    app = create_app()
    with app.app_context():
        db.drop_all()
        db.create_all()
        if testdata:
            user = User(username='******', password='******')
            db.session.add(user)

            db.session.commit()
示例#4
0
def createdb(testdata=False):
    """Initializes the database"""
    app = create_app()
    with app.app_context():
        db.drop_all()
        db.create_all()
        if testdata:
            user = User(username='******', password='******')
            db.session.add(user)

            db.session.commit()
示例#5
0
#!/usr/bin/python
# Run the server

from bucketlistapp.app import create_app
import sys

modules = {
        'development': 'instance.config.DevelopmentConfig',
        'production': 'instance.config.ProductionConfig',
        'test': 'instance.config.TestingConfig',
    }

try:
    if sys.argv[1] in modules.keys():
        app = create_app(modules.get(sys.argv[1]))
        app.run(debug=app.config.get('TESTING'))
    else:
        if sys.argv[1] == '-h':
            print "python run.py <environment>"
            print "\tAvailable options:"
            print "\t - production\n\t - test\n\t - development"
        else:
            print "Invalid option passed as argument"
except IndexError:
    print "[+] python run.py -h to get help"
exit()