# Path: farmsList/settings.py
# class TestConfig(Config):
#     """Testing configuration"""
#     ENV = 'test'
#     TESTING = True
#     DEBUG = True
#     SQLALCHEMY_DATABASE_URI = 'sqlite://'
#     BCRYPT_LOG_ROUNDS = 1  # For faster tests
#     WTF_CSRF_ENABLED = False  # Allows form testing
# 
# Path: farmsList/app.py
# def create_app(config_object=ProdConfig):
#     '''An application factory, as explained here:
#         http://flask.pocoo.org/docs/patterns/appfactories/
# 
#     :param config_object: The configuration object to use.
#     '''
#     app = Flask(__name__)
#     app.config.from_object(config_object)
#     register_extensions(app)
#     register_blueprints(app)
#     register_errorhandlers(app)
#     return app
# 
# Path: farmsList/database.py
# class CRUDMixin(object):
# class Model(CRUDMixin, db.Model):
# class SurrogatePK(object):
#     def create(cls, **kwargs):
#     def update(self, commit=True, **kwargs):
#     def save(self, commit=True):
#     def delete(self, commit=True):
#     def get_by_id(cls, id):
# def ReferenceCol(tablename, nullable=False, pk_name='id', **kwargs):
# 
# Path: tests/factories.py
# class UserFactory(BaseFactory):
#     username = Sequence(lambda n: "user{0}".format(n))
#     email = Sequence(lambda n: "user{0}@example.com".format(n))
#     password = PostGenerationMethodCall('set_password', 'example')
#     active = True
# 
#     class Meta:
#         model = User


import os
import pytest
from webtest import TestApp
from farmsList.settings import TestConfig
from farmsList.app import create_app
from farmsList.database import db as _db
from .factories import UserFactory
# -*- coding: utf-8 -*-
"""Defines fixtures available to all tests."""




@pytest.yield_fixture(scope='function')
def app():
    _app = create_app(TestConfig)
    ctx = _app.test_request_context()
    ctx.push()

    yield _app

    ctx.pop()

@pytest.fixture(scope='session')
def testapp(app):
    """A Webtest app."""
    return TestApp(app)

@pytest.yield_fixture(scope='function')
def db(app):
    _db.app = app
    with app.app_context():
        _db.create_all()

    yield _db


# Path: farmsList/settings.py
# class TestConfig(Config):
#     """Testing configuration"""
#     ENV = 'test'
#     TESTING = True
#     DEBUG = True
#     SQLALCHEMY_DATABASE_URI = 'sqlite://'
#     BCRYPT_LOG_ROUNDS = 1  # For faster tests
#     WTF_CSRF_ENABLED = False  # Allows form testing
# 
# Path: farmsList/app.py
# def create_app(config_object=ProdConfig):
#     '''An application factory, as explained here:
#         http://flask.pocoo.org/docs/patterns/appfactories/
# 
#     :param config_object: The configuration object to use.
#     '''
#     app = Flask(__name__)
#     app.config.from_object(config_object)
#     register_extensions(app)
#     register_blueprints(app)
#     register_errorhandlers(app)
#     return app
# 
# Path: farmsList/database.py
# class CRUDMixin(object):
# class Model(CRUDMixin, db.Model):
# class SurrogatePK(object):
#     def create(cls, **kwargs):
#     def update(self, commit=True, **kwargs):
#     def save(self, commit=True):
#     def delete(self, commit=True):
#     def get_by_id(cls, id):
# def ReferenceCol(tablename, nullable=False, pk_name='id', **kwargs):
# 
# Path: tests/factories.py
# class UserFactory(BaseFactory):
#     username = Sequence(lambda n: "user{0}".format(n))
#     email = Sequence(lambda n: "user{0}@example.com".format(n))
#     password = PostGenerationMethodCall('set_password', 'example')
#     active = True
# 
#     class Meta:
#         model = User


# Path: tests/conftest.py
import os
import pytest
from webtest import TestApp
from farmsList.settings import TestConfig
from farmsList.app import create_app
from farmsList.database import db as _db
from .factories import UserFactory

# -*- coding: utf-8 -*-
"""Defines fixtures available to all tests."""




@pytest.yield_fixture(scope='function')
def app():
    _app = create_app(TestConfig)
    ctx = _app.test_request_context()
    ctx.push()

    yield _app

    ctx.pop()

@pytest.fixture(scope='session')
def testapp(app):
    """A Webtest app."""
    return TestApp(app)

@pytest.yield_fixture(scope='function')
def db(app):
    _db.app = app
    with app.app_context():
        _db.create_all()

    yield _db


    _db.drop_all()