33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
from pillar.tests import PillarTestServer, AbstractPillarTest
|
|
|
|
from attract import AttractExtension
|
|
from attract.setup import setup_for_attract
|
|
|
|
MOCK_SVN_URL = 'svn://biserver/mocked'
|
|
|
|
|
|
class AttractTestServer(PillarTestServer):
|
|
def __init__(self, *args, **kwargs):
|
|
PillarTestServer.__init__(self, *args, **kwargs)
|
|
|
|
self.load_extension(AttractExtension(), '/attract')
|
|
|
|
|
|
class AbstractAttractTest(AbstractPillarTest):
|
|
pillar_server_class = AttractTestServer
|
|
|
|
def ensure_project_exists(self, project_overrides=None):
|
|
project_overrides = dict(
|
|
picture_header=None,
|
|
picture_square=None,
|
|
**(project_overrides or {})
|
|
)
|
|
proj_id, project = AbstractPillarTest.ensure_project_exists(self, project_overrides)
|
|
|
|
with self.app.test_request_context():
|
|
attract_project = setup_for_attract(project['url'],
|
|
replace=True,
|
|
svn_url=MOCK_SVN_URL)
|
|
|
|
return proj_id, attract_project
|