Example #1
0
 def setUp(self):
     db.create_all()
     new_author = Author('newuser', 'secret')
     db.session.add(new_author)
     db.session.commit()
     self.auth_id = new_author.id
     self.auth_name = 'testauthor'
Example #2
0
 def setUp(self):
     app.config[
         'SQLALCHEMY_DATABASE_URI'] = 'sqlite://'  # prevents the unit tests from
     # using the regular database that
     # I use for development. Now,
     # SQLAlchemy uses an in-memory SQLite db.
     db.create_all()  # Creates all the database tables.
Example #3
0
 def setUp(self):
     self.db_fd, app.config['DATABASE'] = tempfile.mkstemp()
     app.config['TESTING'] = True
     self.client = app.test_client()
     db.create_all()
     self.temp_author = TempAuthor('temp', 'admin')
     db.session.add(self.temp_author)
     db.session.commit()
Example #4
0
 def setUp(self):
     self.db_fd, app.config['DATABASE'] = tempfile.mkstemp()
     app.config['TESTING'] = True
     self.client = app.test_client()
     db.create_all()
     new_author = Author('newuser', 'secret')
     db.session.add(new_author)
     db.session.commit()
Example #5
0
    def setUp(self):
        app.config['TESTING'] = True
        app.config['WTF_CSRF_ENABLED'] = False
        app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(
            basedir, 'test.db')

        self.app = app.test_client()
        db.create_all()
Example #6
0
 def setUp(self):
     self.app = create_app(TestConfig)
     self.app_context = self.app.app_context()
     # Flask uses two context:
     # (1) application context (current_app, g)
     # (2) request context (request, session as well as Flask-Login's current_user)
     # It is activated right before a request is handled.
     self.app_context.push(
     )  # push 'app_context' - brings 'current app' and 'g' to life.
     # When the 'request' is complete, the 'context' is removed,
     # along with these variables.
     db.create_all()  # Creates all the database tables.
Example #7
0
    def setUp(self):
        """This sets up the test case.
        It creates database and populates users table with one user.
        This user is used for testing various `users` endpoints.
        This function is executed before every single test.
        """

        db.create_all()
        user = User(first_name="Sid",
                    last_name="Yadav",
                    username="******",
                    email="*****@*****.**")
        user.set_password("password")
        db.session.add(user)
        db.session.commit()
Example #8
0
 def setUp(self):
     db.drop_all()
     db.create_all()
     self.app = app.test_client()
     self.context = app.test_request_context()
     self.email = '*****@*****.**'
     self.author = 'WilliamsCarlosWilliams'
     self.password = '******'
     self.spring = 'Spring and All'
     self.imaginations = '''\tThe imagination, intoxicated by prohibitions,
                     rises to drunken heights to destroy the world. Let it
                     rage, let it kill. The imagination is supreme.'''
     AUTHOR = Author(self.email, self.author, self.password)
     db.session.add(AUTHOR)
     db.session.commit()
     self.context.push()
    def setUp(self):
        app.config['TESTING'] = True
        app.config['WTF_CSRF_ENABLED'] = False
        app.config['DEBUG'] = False
        app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + \
                  os.path.join(basedir, TEST_DB)
        self.app = app.test_client()
        db.create_all()

        dummy_client = Client(name='Client 1')
        db.session.add(dummy_client)

        dummy_product = Product(product='Product 1')
        db.session.add(dummy_product)

        dummy_request = Request(title='test title',
                                desc='test desc',
                                target_date=datetime.now().date(),
                                priority=2,
                                client=dummy_client,
                                product=dummy_product)
        db.session.add(dummy_request)

        db.session.commit()
Example #10
0
#!flask/bin/python
from migrate.versioning import api
from microblog.settings import SQLALCHEMY_DATABASE_URI
from microblog.settings import SQLALCHEMY_MIGRATE_REPO
from microblog import db
import os.path
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
    api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
    api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
else:
    api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, api.version(SQLALCHEMY_MIGRATE_REPO))
Example #11
0
 def setUp(self):
     self.db_fd, app.config['DATABASE'] = tempfile.mkstemp()
     app.config['TESTING'] = True
     self.client = app.test_client()
     db.create_all()
Example #12
0
 def setUp(self):
     self.app = create_app(TestConfig)
     self.app_context = self.app.app_context()
     self.app_context.push()
     db.create_all()
Example #13
0
 def setUp(self):
     db.create_all()