Example #1
0
from mistral import context as auth_context
from mistral.db.sqlalchemy import base as db_sa_base
from mistral.db.sqlalchemy import sqlite_lock
from mistral.db.v2 import api as db_api
from mistral.lang import parser as spec_parser
from mistral.services import action_manager
from mistral.services import security
from mistral.tests.unit import config as test_config
from mistral.utils import inspect_utils as i_utils
from mistral import version
from mistral.workflow import lookup_utils

RESOURCES_PATH = 'tests/resources/'
LOG = logging.getLogger(__name__)

test_config.parse_args()


def get_resource(resource_name):
    return open(
        pkg.resource_filename(version.version_info.package,
                              RESOURCES_PATH + resource_name)).read()


def get_context(default=True, admin=False):
    if default:
        return auth_context.MistralContext.from_dict({
            'user_name': 'test-user',
            'user': '******',
            'tenant': security.DEFAULT_PROJECT_ID,
            'project_name': 'test-project',
Example #2
0
from mistral import context as auth_context
from mistral.db.sqlalchemy import base as db_sa_base
from mistral.db.sqlalchemy import sqlite_lock
from mistral.db.v2 import api as db_api_v2
from mistral.services import action_manager
from mistral.services import security
from mistral.tests.unit import config as test_config
from mistral.utils import inspect_utils as i_utils
from mistral import version


RESOURCES_PATH = 'tests/resources/'
LOG = logging.getLogger(__name__)


test_config.parse_args()


def get_resource(resource_name):
    return open(pkg.resource_filename(
        version.version_info.package,
        RESOURCES_PATH + resource_name)).read()


def get_context(default=True, admin=False):
    if default:
        return auth_context.MistralContext(
            user_id='1-2-3-4',
            project_id=security.DEFAULT_PROJECT_ID,
            user_name='test-user',
            project_name='test-project',