@pytest.fixture(scope='function')
def credit_cards(db):
    db.session.query(CreditCard).delete()

    may_29_2015 = datetime.date(2015, 05, 29)
    june_29_2015 = datetime.datetime(2015, 06, 29, 0, 0, 0)
    june_29_2015 = pytz.utc.localize(june_29_2015)

    credit_cards = [
        {
            'user_id': 1,
            'brand': 'Visa',
            'last4': 4242,
            'exp_date': june_29_2015
        },
        {
            'user_id': 1,
            'brand': 'Visa',
            'last4': 4242,
            'exp_date': timedelta_months(12, may_29_2015)
        }
    ]

    for card in credit_cards:
        db.session.add(CreditCard(**card))

    db.session.commit()

    return db
Test helper for CORS response headers.
dataset/ETHPy150Open nickjj/build-a-saas-app-with-flask/catwatch/tests/conftest.py/credit_cards--crossover with--dataset/ETHPy150Open openstack/oslo.middleware/oslo_middleware/tests/test_cors.py/CORSTestBase.assertCORSResponse