CPI Ordering System (the old version)
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
|
|
|
''' functional tests for ordr2 '''
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
import transaction
|
|
|
|
import webtest
|
|
|
|
|
|
|
|
from .. import APP_SETTINGS
|
|
|
|
|
|
|
|
WEBTEST_SETTINGS = APP_SETTINGS.copy()
|
|
|
|
# WEBTEST_SETTINGS['pyramid.includes'].append('pyramid_mailer.testing')
|
|
|
|
|
|
|
|
|
|
|
|
class CustomTestApp(webtest.TestApp):
|
|
|
|
''' might add custom functionality to webtest.TestApp '''
|
|
|
|
pass
|
|
|
|
|
|
|
|
def login(self, username, password):
|
|
|
|
''' stub for user login '''
|
|
|
|
self.logout()
|
|
|
|
pass
|
|
|
|
|
|
|
|
def logout(self):
|
|
|
|
''' stub for user logout '''
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def create_users(dbsession):
|
|
|
|
''' create example users '''
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope='module')
|
|
|
|
def testapp():
|
|
|
|
''' fixture for using webtest '''
|
|
|
|
from ordr.models.meta import Base
|
|
|
|
from ordr.models import get_tm_session
|
|
|
|
from ordr import main
|
|
|
|
|
|
|
|
app = main({}, **WEBTEST_SETTINGS)
|
|
|
|
testapp = CustomTestApp(app)
|
|
|
|
|
|
|
|
session_factory = app.registry['dbsession_factory']
|
|
|
|
engine = session_factory.kw['bind']
|
|
|
|
Base.metadata.create_all(engine)
|
|
|
|
|
|
|
|
with transaction.manager:
|
|
|
|
# set up test data here
|
|
|
|
dbsession = get_tm_session(session_factory, transaction.manager)
|
|
|
|
create_users(dbsession)
|
|
|
|
|
|
|
|
yield testapp
|
|
|
|
|
|
|
|
Base.metadata.drop_all(engine)
|