Beispiel #1
0
#       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 mox
import testtools
from oslo_config import cfg

from bork_api.common import log

CONF = cfg.CONF
log.setup(CONF, 'validator')


class ValidatorTestCase(testtools.TestCase):
    """Default test environment setter"""
    def setUp(self):
        """setup logger fixture"""
        super(ValidatorTestCase, self).setUp()
        # self.useFixture(fixtures.FakeLogger())
        self.useFixture(fixtures.WarningsCapture())
        self.m = mox.Mox()
        self.addCleanup(self.m.UnsetStubs)

    def override_config(self, name, override, group=None):
        """
        overload config settings
Beispiel #2
0
#!/usr/bin/env python
# coding=utf-8
import os
import sys

from bork_api.common import config, log

APPNAME = "bork_api"
config.setup_config(APPNAME)
log.setup(APPNAME)

LOG = log.getLogger(__name__)
CONF = config.CONF

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "%s.settings" % APPNAME)
    sys.path.insert(1, os.path.abspath('./'))
    from django.core.management import execute_from_command_line
    modded_cmd = sys.argv
    if ":" in sys.argv[-1]:
        modded_cmd = sys.argv[:-1]
        modded_cmd.append("%s:%s" % (CONF.bind_host, CONF.bind_port))
    execute_from_command_line(modded_cmd)
Beispiel #3
0
#       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 mox
import testtools
from oslo_config import cfg

from bork_api.common import log

CONF = cfg.CONF
log.setup(CONF, 'validator')


class ValidatorTestCase(testtools.TestCase):
    """Default test environment setter"""

    def setUp(self):
        """setup logger fixture"""
        super(ValidatorTestCase, self).setUp()
        # self.useFixture(fixtures.FakeLogger())
        self.useFixture(fixtures.WarningsCapture())
        self.m = mox.Mox()
        self.addCleanup(self.m.UnsetStubs)

    def override_config(self, name, override, group=None):
        """
Beispiel #4
0
#!/usr/bin/env python
# coding=utf-8
import os
import sys

from bork_api.common import config, log

APPNAME = "bork_api"
config.setup_config(APPNAME)
log.setup(APPNAME)

LOG = log.getLogger(__name__)
CONF = config.CONF


if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "%s.settings" % APPNAME)
    sys.path.insert(1, os.path.abspath('./'))
    from django.core.management import execute_from_command_line
    modded_cmd = sys.argv
    if ":" in sys.argv[-1]:
        modded_cmd = sys.argv[:-1]
        modded_cmd.append("%s:%s" % (CONF.bind_host, CONF.bind_port))
    execute_from_command_line(modded_cmd)