Example #1
0
def test_context():
    '''
    Test Configuration
    '''
    app = create_app('testing')
    app.config[
        'SQLALCHEMY_DATABASE_URI'] = 'postgres://*****:*****@localhost:5432/verse_testing'
    app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
    app.app_context().push()

    test_client = app.test_client()

    with app.app_context():
        db.create_all()

        dummy_user = UserModel({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******'
        })
        dummy_user.save()

        token = Auth.generate_token(dummy_user.id)
        yield test_client, dummy_user, token

        db.session.close()
        db.drop_all()
Example #2
0
    def setUp(self):
        app.config['TESTING'] = True
        app.config['WTF_CSRF_ENABLED'] = False
        app.config['DEBUG'] = False
        app.config['BASEDIR'] = os.getcwd()
        app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + \
                                                os.path.join(app.config['BASEDIR'], TEST_DB)
        self.client = app.test_client()
        db.drop_all()
        db.create_all()
        self.airport1 = Airport(
            **{
                "name": "name1",
                "city": "city",
                "country": "country",
                "iata": "iata",
                "tz": "tz",
                "type": "type",
                "source": "source",
            })
        self.airport2 = Airport(
            **{
                "name": "name2",
                "city": "city1",
                "country": "country",
                "iata": "iata",
                "tz": "tz3",
                "type": "type",
                "source": "source",
            })
        db.session.add(self.airport1)
        db.session.add(self.airport2)
        db.session.commit()

        self.handle = 'test'
Example #3
0
def db(app):
    # Create the tables
    _db.app = app
    _db.create_all()

    yield _db

    _db.drop_all()
def client():
    """Test client for Flask WSGI application"""
    app = create_app(TestConfig)
    with app.app_context():
        t_client = app.test_client()
        db.create_all()
        yield t_client
        db.drop_all()
Example #5
0
def init_dev_data():
    """Initializes database with data for development and testing"""
    db.drop_all()
    db.create_all()
    print("Initialized Freelance-Tracker Database.")

    db.session.commit()
    print("Added dummy data.")
Example #6
0
    def setUpClass(self):
        """Excuted in the beginning of the test, the target of this test is that all tests run in order at once """
        """Define test variables and initialize src."""
        self.app = create_app()
        self.client = self.app.test_client
        self.database_name = "casting_agency_test"
        self.database_path = "postgresql://*****:*****@{}/{}".format('localhost:5432', self.database_name)

        # binds the src to the current context
        self.new_actor = {"name": "Markos24", "age": 23, "gender": "Male"}
        self.new_movie = {"title": "the real stuff", "release_date": "08/20/2020"}
        setup_db(self.app, self.database_path)

        with self.app.app_context():
            db.init_app(self.app)
            # create all tables
            db.drop_all()
            db.create_all()
 def teardown():
     _db.drop_all()
Example #8
0
def init_db():
    db.drop_all()
    db.create_all()
Example #9
0
 def tearDown(self):
     with app.app_context():
         db.session.remove()
         db.drop_all()
Example #10
0
def create_db():
    db.drop_all()
    db.create_all()
    db.session.commit()
    click.echo("\nDatabase created.\n")
Example #11
0
def tearDownModule():
    with app.app_context():
        models_db.drop_all()
Example #12
0
 def teardown():
     _db.drop_all()
     os.unlink(TESTDB_PATH)
Example #13
0
def init_db():
    """Initializes database and any model objects necessary for assignment"""
    db.drop_all()
    db.create_all()

    print("Initialized Freelance-Tracker Database.")
Example #14
0
def db(app):
    _db.create_all()

    yield _db

    _db.drop_all()
Example #15
0
def seed_all():
    db.drop_all()
    db.create_all()
    phones = create_phones()
    _ = create_tasks(phones)
Example #16
0
 def tearDown(self):
     db.session.remove()
     db.drop_all()
Example #17
0
def drop():
    print "Dropping tables..."
    db.drop_all()
Example #18
0
 def tearDown(self):
     db.drop_all()