def setUp(self): super(TestTransportAuth, self).setUp() self.cfg = config.project('marconi')
"""Marconi Transport Drivers""" from marconi.common import config from marconi.transport import base OPTIONS = {'auth_strategy': ""} CFG = config.project('marconi').from_options(**OPTIONS) # Hoist into package namespace DriverBase = base.DriverBase
# 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. from marconi.common import config from marconi.tests import util as testing PROJECT_CONFIG = config.project() CFG = PROJECT_CONFIG.from_options( without_help=3, with_help=(None, 'nonsense')) class TestConfig(testing.TestBase): def test_cli(self): args = ['--with_help', 'sense'] PROJECT_CONFIG.load(self.conf_path('wsgi_sqlite.conf'), args) self.assertEquals(CFG.with_help, 'sense') PROJECT_CONFIG.load(args=[]) self.assertEquals(CFG.with_help, None)
"""Marconi Transport Drivers""" from marconi.common import config from marconi.queues.transport import base OPTIONS = { 'auth_strategy': "" } CFG = config.project('marconi').from_options(**OPTIONS) # Hoist into package namespace DriverBase = base.DriverBase
# # 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. from marconi.common import config from marconi.common import exceptions from marconi.openstack.common import importutils cfg_handle = config.project('marconi') cfg = config.namespace('drivers').from_options( transport='marconi.transport.wsgi', storage='marconi.storage.sqlite') class Bootstrap(object): """ Defines the Marconi Bootstrap The bootstrap loads up drivers per a given configuration, and manages their lifetimes. """ def __init__(self, config_file=None, cli_args=None): cfg_handle.load(filename=config_file, args=cli_args)
# 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. from marconi.common import config from marconi.tests import util as testing cfg_handle = config.project() cfg = cfg_handle.from_options( without_help=3, with_help=(None, "nonsense")) class TestConfig(testing.TestBase): def test_cli(self): args = ['--with_help', 'sense'] cfg_handle.load(self.conf_path('wsgi_sqlite.conf'), args) self.assertEquals(cfg.with_help, 'sense') cfg_handle.load(args=[]) self.assertEquals(cfg.with_help, None)
# 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. from stevedore import driver from marconi.common import config from marconi.common import decorators from marconi.common import exceptions from marconi.openstack.common import log from marconi import transport # NOQA PROJECT_CFG = config.project('marconi') CFG = config.namespace('drivers').from_options( transport='wsgi', storage='sqlite') LOG = log.getLogger(__name__) class Bootstrap(object): """Defines the Marconi bootstrapper. The bootstrap loads up drivers per a given configuration, and manages their lifetimes. """ def __init__(self, config_file=None, cli_args=None):
# # 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 testtools from marconi.common import config from marconi.tests import util as testing cfg = config.project().from_options(without_help=3, with_help=(None, "nonsense")) class TestConfig(testing.TestBase): def test_cli(self): args = ['--with_help', 'sense'] cfg.set_cli(args) cfg.load(self.conf_path('wsgi_reference.conf')) self.assertEquals(cfg.with_help, 'sense') cfg.set_cli([]) cfg.load() self.assertEquals(cfg.with_help, None) def test_wrong_type(self): ns = config.namespace('local') with testtools.ExpectedException(config.cfg.Error):
# 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 fixtures import os import testtools from marconi.common import config CFG = config.project() class TestBase(testtools.TestCase): """Child class of testtools.TestCase for testing Marconi. Inherit from this and write your test methods. If the child class defines a prepare(self) method, this method will be called before executing each test method. """ def setUp(self): super(TestBase, self).setUp() self.useFixture(fixtures.FakeLogger('marconi')) # NOTE(kgriffs): Don't monkey-patch stdout since it breaks
# 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 os import testtools from marconi.common import config cfg = config.project() class TestBase(testtools.TestCase): """ Child class of testtools.TestCase for testing Marconi Inherit from this and write your test methods. If the child class defines a prepare(self) method, this method will be called before executing each test method. """ def conf_path(self, filename): """ Returns the full path to the specified Marconi conf file
# you may not use this file except in compliance with 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. from marconi.common import config from marconi.tests import util as testing PROJECT_CONFIG = config.project() CFG = PROJECT_CONFIG.from_options(without_help=3, with_help=(None, 'nonsense')) class TestConfig(testing.TestBase): def test_cli(self): args = ['--with_help', 'sense'] PROJECT_CONFIG.load(self.conf_path('wsgi_sqlite.conf'), args) self.assertEquals(CFG.with_help, 'sense') PROJECT_CONFIG.load(args=[]) self.assertEquals(CFG.with_help, None) def test_wrong_type(self): ns = config.namespace('local') with testing.expect(config.cfg.Error):
# 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 testtools from marconi.common import config from marconi.tests import util as testing cfg = config.project().from_options(without_help=3, with_help=(None, "nonsense")) class TestConfig(testing.TestBase): def test_cli(self): args = ['--with_help', 'sense'] cfg.set_cli(args) cfg.load(self.conf_path('wsgi_reference.conf')) self.assertEquals(cfg.with_help, 'sense') cfg.set_cli([]) cfg.load() self.assertEquals(cfg.with_help, None) def test_wrong_type(self): ns = config.namespace('local')
# # 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. from marconi.common import config from marconi.storage import reference as storage from marconi.transport.wsgi import driver as wsgi cfg = config.project('marconi').from_options() class Bootstrap(object): """ Defines the Marconi Bootstrap The bootstrap loads up drivers per a given configuration, and manages their lifetimes. """ def __init__(self, config_file=None): #TODO(kgriffs): Error handling cfg.load(config_file) #TODO(kgriffs): Determine driver types from cfg
# 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. from marconi.common import config from marconi.storage import reference as storage from marconi.transport.wsgi import driver as wsgi cfg = config.project('marconi').from_options() class Bootstrap(object): """ Defines the Marconi Bootstrap The bootstrap loads up drivers per a given configuration, and manages their lifetimes. """ def __init__(self, config_file=None): #TODO(kgriffs): Error handling cfg.load(config_file) #TODO(kgriffs): Determine driver types from cfg self.storage = storage.Driver()
# 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 fixtures import os import testtools from marconi.common import config CFG = config.project() class TestBase(testtools.TestCase): """Child class of testtools.TestCase for testing Marconi. Inherit from this and write your test methods. If the child class defines a prepare(self) method, this method will be called before executing each test method. """ def setUp(self): super(TestBase, self).setUp() self.useFixture(fixtures.FakeLogger("marconi"))