Example #1
0
File: base.py Project: Bala96/st2
    def _do_setUpClass(cls):
        tests_config.parse_args()

        cfg.CONF.set_default('enable', cls.enable_auth, group='auth')

        cfg.CONF.set_override(name='enable', override=False, group='rbac')

        opts = cfg.CONF.api_pecan
        cfg_dict = {
            'app': {
                'root': opts.root,
                'template_path': opts.template_path,
                'modules': opts.modules,
                'debug': opts.debug,
                'auth_enable': opts.auth_enable,
                'errors': {'__force_dict__': True},
                'guess_content_type_from_ext': False
            }
        }

        # TODO(manas) : register action types here for now. RunnerType registration can be moved
        # to posting to /runnertypes but that implies implementing POST.
        runners_registrar.register_runner_types()

        cls.app = load_test_app(config=cfg_dict)
 def setUpClass(cls):
     super(HashPartitionerTest, cls).setUpClass()
     # Create TriggerTypes before creation of Rule to avoid failure. Rule requires the
     # Trigger and therefore TriggerType to be created prior to rule creation.
     cls.models = FixturesLoader().save_fixtures_to_db(
         fixtures_pack=PACK, fixtures_dict=FIXTURES_1)
     config.parse_args()
Example #3
0
    def setUpClass(cls):
        tests_config.parse_args()

        # Store original values so we can restore them in setUp
        cls.old_path = os.environ.get('PATH', '')
        cls.old_python_path = os.environ.get('PYTHONPATH', '')
        cls.old_real_prefix = sys.real_prefix
Example #4
0
File: base.py Project: langelee/st2
    def setUpClass(cls):
        super(FunctionalTest, cls).setUpClass()

        tests_config.parse_args()

        # Make sure auth is disabled
        cfg.CONF.set_default('enable', False, group='auth')

        # Make sure RBAC is disabled
        cfg.CONF.set_override(name='enable', override=False, group='rbac')

        opts = cfg.CONF.api_pecan
        cfg_dict = {
            'app': {
                'root': opts.root,
                'template_path': opts.template_path,
                'modules': opts.modules,
                'debug': opts.debug,
                'auth_enable': opts.auth_enable,
                'errors': {'__force_dict__': True}
            }
        }

        # TODO(manas) : register action types here for now. RunnerType registration can be moved
        # to posting to /runnertypes but that implies implementing POST.
        runners_registrar.register_runner_types()

        cls.app = load_test_app(config=cfg_dict)
Example #5
0
    def setUp(self):
        super(ContentPackConfigParserTestCase, self).setUp()
        tests_config.parse_args()

        # Mock the packs_base_path
        mock_path = tests_base.get_fixtures_path()
        cfg.CONF.content.packs_base_path = mock_path
Example #6
0
    def setUp(self):
        super(DatastoreServiceTestCase, self).setUp()
        config.parse_args()

        self._datastore_service = BaseDatastoreService(logger=mock.Mock(),
                                                       pack_name='core',
                                                       class_name='TestSensor')
        self._datastore_service._get_api_client = mock.Mock()
Example #7
0
    def setUpClass(cls):
        tests_config.parse_args(coordinator_noop=True)

        super(ServiceRegistryControllerRBACTestCase, cls).setUpClass()

        cls.coordinator = coordination.get_coordinator(use_cache=False)

        # Register mock service in the service registry for testing purposes
        register_service_in_service_registry(service='mock_service',
                                             capabilities={'key1': 'value1',
                                                           'name': 'mock_service'},
                                             start_heart=True)
Example #8
0
    def setUp(self):
        super(VirtualenvUtilsTestCase, self).setUp()
        config.parse_args()

        dir_path = tempfile.mkdtemp()
        cfg.CONF.set_override(name='base_path', override=dir_path, group='system')

        self.base_path = dir_path
        self.virtualenvs_path = os.path.join(self.base_path, 'virtualenvs/')

        # Make sure dir is deleted on tearDown
        self.to_delete_directories.append(self.base_path)
Example #9
0
    def setUpClass(cls):
        super(ServiceyRegistryControllerTestCase, cls).setUpClass()

        tests_config.parse_args(coordinator_noop=True)

        cls.coordinator = coordination.get_coordinator(use_cache=False)

        # NOTE: We mock call common_setup to emulate service being registered in the service
        # registry during bootstrap phase
        register_service_in_service_registry(service='mock_service',
                                             capabilities={'key1': 'value1',
                                                           'name': 'mock_service'},
                                             start_heart=True)
Example #10
0
    def _do_setUpClass(cls):
        tests_config.parse_args()

        cfg.CONF.set_default('enable', cls.enable_auth, group='auth')

        cfg.CONF.set_override(name='enable', override=False, group='rbac')

        # TODO(manas) : register action types here for now. RunnerType registration can be moved
        # to posting to /runnertypes but that implies implementing POST.
        if cls.register_runners:
            runners_registrar.register_runners()

        cls.app = TestApp(cls.app_module.setup_app())
Example #11
0
    def setUpClass(cls):
        EventletTestCase.setUpClass()
        DbTestCase.setUpClass()

        # Override the coordinator to use the noop driver otherwise the tests will be blocked.
        tests_config.parse_args(coordinator_noop=True)
        coordination.COORDINATOR = None

        # Register runners
        runners_registrar.register_runners()

        # Register common policy types
        register_policy_types(st2common)

        loader = FixturesLoader()
        loader.save_fixtures_to_db(fixtures_pack=PACK,
                                   fixtures_dict=TEST_FIXTURES)
Example #12
0
    def setUpClass(cls):
        super(AuthMiddlewareTest, cls).setUpClass()
        tests_config.parse_args()

        opts = cfg.CONF.api_pecan
        cfg_dict = {
            'app': {
                'root': opts.root,
                'template_path': opts.template_path,
                'modules': opts.modules,
                'debug': opts.debug,
                'auth_enable': opts.auth_enable,
                'errors': {'__force_dict__': True}
            }
        }

        # TODO(manas) : register action types here for now. RunnerType registration can be moved
        # to posting to /runnertypes but that implies implementing POST.
        runners_registrar.register_runner_types()

        cls.app = TestApp(auth.AuthMiddleware(load_app(cfg_dict)))
Example #13
0
 def setUpClass(cls):
     super(AccessServiceTest, cls).setUpClass()
     tests_config.parse_args()
Example #14
0
 def setUpClass(cls):
     super(SynchronizationTest, cls).setUpClass()
     tests_config.parse_args()
     cls.coordinator = coordination.get_coordinator()
Example #15
0
 def setUpClass(cls):
     super(RBACRoleDBTestCase, cls).setUpClass()
     config.parse_args()
 def setUpClass(cls):
     super(RBACMigrationsTestCase, cls).setUpClass()
     config.parse_args()
Example #17
0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import unittest2

from oslo_config import cfg

from st2common.constants.api import DEFAULT_API_VERSION
from st2common.util.api import get_base_public_api_url
from st2common.util.api import get_full_public_api_url
from st2tests.config import parse_args
parse_args()


class APIUtilsTestCase(unittest2.TestCase):
    def test_get_base_public_api_url(self):
        values = [
            'http://foo.bar.com',
            'http://foo.bar.com/',
            'http://foo.bar.com:8080',
            'http://foo.bar.com:8080/',
            'http://localhost:8080/',
        ]
        expected = [
            'http://foo.bar.com',
            'http://foo.bar.com',
            'http://foo.bar.com:8080',
Example #18
0
 def setUpClass(cls):
     super(SynchronizationTest, cls).setUpClass()
     tests_config.parse_args(coordinator_noop=False)
     cls.coordinator = coordination.get_coordinator(use_cache=False)
Example #19
0
 def setUpClass(cls):
     super(SensorServiceTestCase, cls).setUpClass()
     tests_config.parse_args()
Example #20
0
 def setUpClass(cls):
     super(RBACUtilsTestCase, cls).setUpClass()
     config.parse_args()
Example #21
0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import unittest2

from oslo.config import cfg

from st2common.constants.api import DEFAULT_API_VERSION
from st2common.util.api import get_base_public_api_url
from st2common.util.api import get_full_public_api_url
from st2tests.config import parse_args
parse_args()


class APIUtilsTestCase(unittest2.TestCase):
    def test_get_base_public_api_url(self):
        values = [
            'http://foo.bar.com',
            'http://foo.bar.com/',
            'http://foo.bar.com:8080',
            'http://foo.bar.com:8080/',
            'http://localhost:8080/',
        ]
        expected = [
            'http://foo.bar.com',
            'http://foo.bar.com',
            'http://foo.bar.com:8080',
Example #22
0
 def setUp(self):
     super(ValidationUtilsTestCase, self).setUp()
     tests_config.parse_args()
 def setUpClass(cls):
     tests_config.parse_args()
 def setUpClass(cls):
     config.parse_args()
Example #25
0
 def setUpClass(cls):
     super(SensorWrapperTestCase, cls).setUpClass()
     tests_config.parse_args()
Example #26
0
 def setUpClass(cls):
     super(SensorServiceTestCase, cls).setUpClass()
     tests_config.parse_args()
Example #27
0
 def setUp(self):
     super(ContentPackConfigParserTestCase, self).setUp()
     tests_config.parse_args()
Example #28
0
 def setUpClass(cls):
     super(RBACRoleDBTestCase, cls).setUpClass()
     config.parse_args()
Example #29
0
 def setUpClass(cls):
     config.parse_args()
 def setUp(self):
     super(ContentRegisterScriptTestCase, self).setUp()
     test_config.parse_args()
Example #31
0
 def setUp(self):
     super(ValidationUtilsTestCase, self).setUp()
     tests_config.parse_args()
Example #32
0
import copy
import uuid

import mock
import yaml

from mistralclient.api.v2 import executions
from mistralclient.api.v2 import tasks
from mistralclient.api.v2 import workbooks
from mistralclient.api.v2 import workflows
from oslo_config import cfg

# XXX: actionsensor import depends on config being setup.
import st2tests.config as tests_config
tests_config.parse_args()

from mistral_v2.mistral_v2 import MistralRunner
from st2common.bootstrap import actionsregistrar
from st2common.bootstrap import runnersregistrar
from st2common.constants import action as action_constants
from st2common.models.db.liveaction import LiveActionDB
from st2common.runners import base as runners
from st2common.services import action as action_service
from st2common.transport.liveaction import LiveActionPublisher
from st2common.transport.publishers import CUDPublisher
from st2common.util import loader
from st2tests import ExecutionDbTestCase
from st2tests import fixturesloader
from st2tests.mocks.liveaction import MockLiveActionPublisher
Example #33
0
 def setUp(self):
     parse_args()
Example #34
0
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import uuid

import mock

import st2tests.config as tests_config
tests_config.parse_args()

from unittest2 import TestCase
from st2actions.container.service import RunnerContainerService
from st2common.constants import action as action_constants
from st2tests.fixturesloader import FixturesLoader
import noop_runner


class TestNoopRunner(TestCase):

    fixtures_loader = FixturesLoader()

    def test_noop_command_executes(self):
        models = TestNoopRunner.fixtures_loader.load_models(
            fixtures_pack='generic', fixtures_dict={'actions': ['noop.yaml']})
Example #35
0
 def setUpClass(cls):
     super(RBACUtilsTestCase, cls).setUpClass()
     config.parse_args()
Example #36
0
 def setUpClass(cls):
     super(RBACMigrationsTestCase, cls).setUpClass()
     config.parse_args()
 def setUpClass(cls):
     super(RBACUtilsTestCase, cls).setUpClass()
     config.parse_args()
     cfg.CONF.set_override(name='backend',
                           override='enterprise',
                           group='rbac')
Example #38
0
 def setUp(self):
     parse_args()
 def setUp(self):
     super(ContentRegisterScriptTestCase, self).setUp()
     test_config.parse_args()
Example #40
0
 def setUpClass(cls):
     super(SynchronizationTest, cls).setUpClass()
     tests_config.parse_args(coordinator_noop=False)
     cls.coordinator = coordination.get_coordinator(use_cache=False)
Example #41
0
 def setUpClass(cls):
     super(SensorWrapperTestCase, cls).setUpClass()
     tests_config.parse_args()
Example #42
0
 def setUpClass(cls):
     super(AccessServiceTest, cls).setUpClass()
     tests_config.parse_args()
Example #43
0
 def setUpClass(cls, **kwargs):
     super(FunctionalTest, cls).setUpClass()
     tests_config.parse_args()
     cls.app = TestApp(app.setup_app(), **kwargs)
Example #44
0
File: base.py Project: chadpatt/st2
    def setUpClass(cls):
        tests_config.parse_args()

        if cls.DISPLAY_LOG_MESSAGES:
            config_path = os.path.join(BASE_DIR, "../conf/logging.conf")
            logging.config.fileConfig(config_path, disable_existing_loggers=False)
 def setUpClass(cls):
     tests_config.parse_args()
Example #46
0
 def setUpClass(cls):
     super(SynchronizationTest, cls).setUpClass()
     tests_config.parse_args()
     cls.coordinator = coordination.get_coordinator()
Example #47
0
 def setUp(self):
     super(ContentPackConfigParserTestCase, self).setUp()
     tests_config.parse_args()
Example #48
0
 def setUpClass(cls, **kwargs):
     super(FunctionalTest, cls).setUpClass()
     tests_config.parse_args()
     cls.app = TestApp(app.setup_app(), **kwargs)