Move all common tests to top level folder
Moves all tests under orm/common to the top level tests folder and makes minimal necessary changes to get them working. Change-Id: Ib813d130ac5a2b3e2205c3a0d9cbeff46359ced1
This commit is contained in:
parent
0979e50eea
commit
20aa6dcdba
@ -3,9 +3,9 @@ import logging
|
||||
|
||||
import requests
|
||||
|
||||
from keystoneclient.v2_0 import client as v2_client
|
||||
from keystoneclient.v3 import client as v3_client
|
||||
from orm_common.utils import dictator
|
||||
from orm.common.client.keystone.mock_keystone.keystoneclient.v2_0 import client as v2_client
|
||||
from orm.common.client.keystone.mock_keystone.keystoneclient.v3 import client as v3_client
|
||||
from orm.common.orm_common.utils import dictator
|
||||
|
||||
_verify = False
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import json
|
||||
import logging
|
||||
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
from orm.common.orm_common.utils import api_error_utils as err_utils
|
||||
from pecan.hooks import PecanHook
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -1,4 +1,4 @@
|
||||
from orm_common.utils import utils
|
||||
from orm.common.orm_common.utils import utils
|
||||
from pecan import abort
|
||||
from pecan.hooks import PecanHook
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import logging
|
||||
from orm.common.orm_common.injector.errors import ProviderNotFoundError
|
||||
from orm.common.orm_common.injector.fang.errors import ProviderNotFoundError
|
||||
|
||||
|
||||
# This is effectively what is sometimes termed a "dependency injection
|
||||
|
@ -1,10 +1,10 @@
|
||||
import imp
|
||||
import os
|
||||
|
||||
from orm_common.injector import fang
|
||||
from orm_common.utils.sanitize import sanitize_symbol_name
|
||||
from orm.common.orm_common.injector.fang import di
|
||||
from orm.common.orm_common.utils.sanitize import sanitize_symbol_name
|
||||
|
||||
_di = fang.Di()
|
||||
_di = di.Di()
|
||||
logger = None
|
||||
|
||||
|
||||
|
@ -20,8 +20,8 @@ import logging
|
||||
|
||||
import six
|
||||
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
from orm_common.utils import dictator
|
||||
from orm.common.orm_common.utils import api_error_utils as err_utils
|
||||
from orm.common.orm_common.utils import dictator
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -21,7 +21,6 @@ import re
|
||||
import six
|
||||
|
||||
import _checks
|
||||
from oslo_policy._i18n import _LE
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -211,7 +210,7 @@ def _parse_check(rule):
|
||||
try:
|
||||
kind, match = rule.split(':', 1)
|
||||
except Exception:
|
||||
LOG.exception(_LE('Failed to understand rule %s'), rule)
|
||||
LOG.exception('Failed to understand rule %s', rule)
|
||||
# If the rule is invalid, we'll fail closed
|
||||
return _checks.FalseCheck()
|
||||
|
||||
@ -221,7 +220,7 @@ def _parse_check(rule):
|
||||
elif None in _checks.registered_checks:
|
||||
return _checks.registered_checks[None](kind, match)
|
||||
else:
|
||||
LOG.error(_LE('No handler for matches of kind %s'), kind)
|
||||
LOG.error('No handler for matches of kind %s', kind)
|
||||
return _checks.FalseCheck()
|
||||
|
||||
|
||||
@ -337,7 +336,7 @@ def _parse_text_rule(rule):
|
||||
return state.result
|
||||
except ValueError:
|
||||
# Couldn't parse the rule
|
||||
LOG.exception(_LE('Failed to understand rule %s'), rule)
|
||||
LOG.exception('Failed to understand rule %s', rule)
|
||||
|
||||
# Fail closed
|
||||
return _checks.FalseCheck()
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
import logging
|
||||
|
||||
from keystone_utils import tokens
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
from orm_common.utils import dictator
|
||||
from orm.common.client.keystone.keystone_utils import tokens
|
||||
from orm.common.orm_common.utils import api_error_utils as err_utils
|
||||
from orm.common.orm_common.utils import dictator
|
||||
import qolicy
|
||||
from wsme.exc import ClientSideError
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
[tox]
|
||||
envlist=py27,cover
|
||||
|
||||
[testenv]
|
||||
setenv= CMS_ENV=mock
|
||||
PYTHONPATH={toxinidir}:{toxinidir}/orm_common/extenal_mock/
|
||||
deps= -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
|
||||
[testenv:pep8]
|
||||
commands =
|
||||
py.test --pep8 -m pep8
|
||||
|
||||
[testenv:cover]
|
||||
commands=
|
||||
coverage run setup.py test
|
||||
coverage report --omit=orm_common/policy/_parser.py,orm_common/policy/qolicy.py
|
||||
coverage html
|
@ -3,7 +3,7 @@ import logging
|
||||
from unittest import TestCase
|
||||
|
||||
import mock
|
||||
from orm_common.hooks import api_error_hook
|
||||
from orm.common.orm_common.hooks import api_error_hook
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -1,7 +1,7 @@
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
from orm_common.policy import _checks
|
||||
from orm.common.orm_common.policy import _checks
|
||||
from wsme.exc import ClientSideError
|
||||
|
||||
|
@ -3,7 +3,7 @@ import os
|
||||
from unittest import TestCase
|
||||
|
||||
import mock
|
||||
from orm_common.injector import injector
|
||||
from orm.common.orm_common.injector import injector
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -1,7 +1,7 @@
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
from orm_common.policy import policy
|
||||
from orm.common.orm_common.policy import policy
|
||||
|
||||
|
||||
class TestException(Exception):
|
@ -1,7 +1,7 @@
|
||||
from unittest import TestCase
|
||||
|
||||
import mock
|
||||
from orm_common.hooks import security_headers_hook
|
||||
from orm.common.orm_common.hooks import security_headers_hook
|
||||
|
||||
|
||||
class MyHeaders(object):
|
@ -2,7 +2,7 @@ import logging
|
||||
from unittest import TestCase
|
||||
|
||||
import mock
|
||||
from orm_common.hooks import transaction_id_hook
|
||||
from orm.common.orm_common.hooks import transaction_id_hook
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
Loading…
Reference in New Issue
Block a user