Merge "Move services/cms tests to top level test folder"
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from cms_rest.logger import get_logger
|
|
||||||
from cms_rest import model
|
|
||||||
from cms_rest.utils import authentication
|
|
||||||
from orm_common.policy import policy
|
|
||||||
from orm_common.utils import utils
|
|
||||||
from pecan.commands import CommandRunner
|
from pecan.commands import CommandRunner
|
||||||
from pecan import make_app
|
from pecan import make_app
|
||||||
|
|
||||||
|
from orm.common.orm_common.policy import policy
|
||||||
|
from orm.common.orm_common.utils import utils
|
||||||
|
from orm.services.customer_manager.cms_rest.logger import get_logger
|
||||||
|
from orm.services.customer_manager.cms_rest import model
|
||||||
|
from orm.services.customer_manager.cms_rest.utils import authentication
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
from cms_rest.controllers.v1 import root as v1
|
from orm.services.customer_manager.cms_rest.controllers.v1 import root as v1
|
||||||
from pecan import expose
|
from pecan import expose
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from orm_common.utils import utils
|
from orm.common.orm_common.utils import utils
|
||||||
from pecan import conf, rest
|
from pecan import conf, rest
|
||||||
from wsmeext.pecan import wsexpose
|
from wsmeext.pecan import wsexpose
|
||||||
|
|
||||||
|
@@ -1,13 +1,14 @@
|
|||||||
from cms_rest.logger import get_logger
|
|
||||||
from cms_rest.logic.customer_logic import CustomerLogic
|
|
||||||
from cms_rest.logic.error_base import ErrorStatus
|
|
||||||
from cms_rest.model.Models import CustomerResultWrapper, Enabled
|
|
||||||
from cms_rest.utils import authentication
|
|
||||||
from orm_common.utils import api_error_utils as err_utils
|
|
||||||
from orm_common.utils import utils
|
|
||||||
from pecan import request, rest
|
from pecan import request, rest
|
||||||
from wsmeext.pecan import wsexpose
|
from wsmeext.pecan import wsexpose
|
||||||
|
|
||||||
|
from orm.common.orm_common.utils import api_error_utils as err_utils
|
||||||
|
from orm.common.orm_common.utils import utils
|
||||||
|
from orm.services.customer_manager.cms_rest.logger import get_logger
|
||||||
|
from orm.services.customer_manager.cms_rest.logic.customer_logic import CustomerLogic
|
||||||
|
from orm.services.customer_manager.cms_rest.logic.error_base import ErrorStatus
|
||||||
|
from orm.services.customer_manager.cms_rest.model.Models import CustomerResultWrapper, Enabled
|
||||||
|
from orm.services.customer_manager.cms_rest.utils import authentication
|
||||||
|
|
||||||
LOG = get_logger(__name__)
|
LOG = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,13 +1,14 @@
|
|||||||
from cms_rest.logger import get_logger
|
|
||||||
from cms_rest.logic.error_base import ErrorStatus
|
|
||||||
import cms_rest.logic.metadata_logic as logic
|
|
||||||
from cms_rest.model.Models import CustomerResultWrapper, MetadataWrapper
|
|
||||||
from cms_rest.utils import authentication
|
|
||||||
from orm_common.utils import api_error_utils as err_utils
|
|
||||||
from orm_common.utils import utils
|
|
||||||
from pecan import request, rest
|
from pecan import request, rest
|
||||||
from wsmeext.pecan import wsexpose
|
from wsmeext.pecan import wsexpose
|
||||||
|
|
||||||
|
from orm.common.orm_common.utils import api_error_utils as err_utils
|
||||||
|
from orm.common.orm_common.utils import utils
|
||||||
|
from orm.services.customer_manager.cms_rest.logger import get_logger
|
||||||
|
from orm.services.customer_manager.cms_rest.logic.error_base import ErrorStatus
|
||||||
|
import orm.services.customer_manager.cms_rest.logic.metadata_logic as logic
|
||||||
|
from orm.services.customer_manager.cms_rest.model.Models import CustomerResultWrapper, MetadataWrapper
|
||||||
|
from orm.services.customer_manager.cms_rest.utils import authentication
|
||||||
|
|
||||||
LOG = get_logger(__name__)
|
LOG = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,15 +1,16 @@
|
|||||||
from cms_rest.controllers.v1.orm.customer.users import UserController
|
|
||||||
from cms_rest.logger import get_logger
|
|
||||||
from cms_rest.logic.customer_logic import CustomerLogic
|
|
||||||
from cms_rest.logic.error_base import ErrorStatus
|
|
||||||
from cms_rest.model.Models import Region, RegionResultWrapper
|
|
||||||
from cms_rest.utils import authentication
|
|
||||||
from orm_common.utils import api_error_utils as err_utils
|
|
||||||
from orm_common.utils import utils
|
|
||||||
from oslo_db.exception import DBDuplicateEntry
|
from oslo_db.exception import DBDuplicateEntry
|
||||||
from pecan import request, rest
|
from pecan import request, rest
|
||||||
from wsmeext.pecan import wsexpose
|
from wsmeext.pecan import wsexpose
|
||||||
|
|
||||||
|
from orm.common.orm_common.utils import api_error_utils as err_utils
|
||||||
|
from orm.common.orm_common.utils import utils
|
||||||
|
from orm.services.customer_manager.cms_rest.controllers.v1.orm.customer.users import UserController
|
||||||
|
from orm.services.customer_manager.cms_rest.logger import get_logger
|
||||||
|
from orm.services.customer_manager.cms_rest.logic.customer_logic import CustomerLogic
|
||||||
|
from orm.services.customer_manager.cms_rest.logic.error_base import ErrorStatus
|
||||||
|
from orm.services.customer_manager.cms_rest.model.Models import Region, RegionResultWrapper
|
||||||
|
from orm.services.customer_manager.cms_rest.utils import authentication
|
||||||
|
|
||||||
LOG = get_logger(__name__)
|
LOG = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2,18 +2,17 @@ from pecan import rest, request, response
|
|||||||
import oslo_db
|
import oslo_db
|
||||||
from wsmeext.pecan import wsexpose
|
from wsmeext.pecan import wsexpose
|
||||||
|
|
||||||
from cms_rest.controllers.v1.orm.customer.enabled import EnabledController
|
from orm.common.orm_common.utils import api_error_utils as err_utils
|
||||||
from cms_rest.controllers.v1.orm.customer.metadata import MetadataController
|
from orm.common.orm_common.utils import utils
|
||||||
from cms_rest.controllers.v1.orm.customer.regions import RegionController
|
from orm.services.customer_manager.cms_rest.controllers.v1.orm.customer.enabled import EnabledController
|
||||||
from cms_rest.controllers.v1.orm.customer.users import DefaultUserController
|
from orm.services.customer_manager.cms_rest.controllers.v1.orm.customer.metadata import MetadataController
|
||||||
from cms_rest.logic.customer_logic import CustomerLogic
|
from orm.services.customer_manager.cms_rest.controllers.v1.orm.customer.regions import RegionController
|
||||||
from cms_rest.logic.error_base import ErrorStatus
|
from orm.services.customer_manager.cms_rest.controllers.v1.orm.customer.users import DefaultUserController
|
||||||
from cms_rest.model.Models import Customer, CustomerResultWrapper, CustomerSummaryResponse
|
from orm.services.customer_manager.cms_rest.logger import get_logger
|
||||||
from cms_rest.utils import authentication
|
from orm.services.customer_manager.cms_rest.logic.customer_logic import CustomerLogic
|
||||||
from orm_common.utils import api_error_utils as err_utils
|
from orm.services.customer_manager.cms_rest.logic.error_base import ErrorStatus
|
||||||
from orm_common.utils import utils
|
from orm.services.customer_manager.cms_rest.model.Models import Customer, CustomerResultWrapper, CustomerSummaryResponse
|
||||||
|
from orm.services.customer_manager.cms_rest.utils import authentication
|
||||||
from cms_rest.logger import get_logger
|
|
||||||
|
|
||||||
LOG = get_logger(__name__)
|
LOG = get_logger(__name__)
|
||||||
|
|
||||||
|
@@ -1,13 +1,14 @@
|
|||||||
from cms_rest.logger import get_logger
|
|
||||||
from cms_rest.logic.customer_logic import CustomerLogic
|
|
||||||
from cms_rest.logic.error_base import ErrorStatus, NotFound
|
|
||||||
from cms_rest.model.Models import User, UserResultWrapper
|
|
||||||
from cms_rest.utils import authentication
|
|
||||||
from orm_common.utils import api_error_utils as err_utils
|
|
||||||
from orm_common.utils import utils
|
|
||||||
from pecan import request, rest
|
from pecan import request, rest
|
||||||
from wsmeext.pecan import wsexpose
|
from wsmeext.pecan import wsexpose
|
||||||
|
|
||||||
|
from orm.common.orm_common.utils import api_error_utils as err_utils
|
||||||
|
from orm.common.orm_common.utils import utils
|
||||||
|
from orm.services.customer_manager.cms_rest.logger import get_logger
|
||||||
|
from orm.services.customer_manager.cms_rest.logic.customer_logic import CustomerLogic
|
||||||
|
from orm.services.customer_manager.cms_rest.logic.error_base import ErrorStatus, NotFound
|
||||||
|
from orm.services.customer_manager.cms_rest.model.Models import User, UserResultWrapper
|
||||||
|
from orm.services.customer_manager.cms_rest.utils import authentication
|
||||||
|
|
||||||
LOG = get_logger(__name__)
|
LOG = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
from cms_rest.controllers.v1.orm.configuration import ConfigurationController
|
from __future__ import absolute_import
|
||||||
from cms_rest.controllers.v1.orm.customer.root import CustomerController
|
|
||||||
from cms_rest.controllers.v1.orm.logs import LogsController
|
from ..orm.configuration import ConfigurationController
|
||||||
|
from ..orm.customer.root import CustomerController
|
||||||
|
from ..orm.logs import LogsController
|
||||||
from pecan.rest import RestController
|
from pecan.rest import RestController
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
from cms_rest.controllers.v1.orm.root import OrmController
|
from orm.root import OrmController
|
||||||
from pecan.rest import RestController
|
from pecan.rest import RestController
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,14 +1,13 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from cms_rest.data.sql_alchemy.customer_record import CustomerRecord
|
from orm.services.customer_manager.cms_rest.data.sql_alchemy.customer_record import CustomerRecord
|
||||||
from cms_rest.data.sql_alchemy.customer_region_record import \
|
from orm.services.customer_manager.cms_rest.data.sql_alchemy.customer_region_record import CustomerRegionRecord
|
||||||
CustomerRegionRecord
|
from orm.services.customer_manager.cms_rest.data.sql_alchemy.models import (CmsRole, CmsUser, Customer,
|
||||||
from cms_rest.data.sql_alchemy.models import (CmsRole, CmsUser, Customer,
|
CustomerRegion, Quota,
|
||||||
CustomerRegion, Quota,
|
QuotaFieldDetail, Region,
|
||||||
QuotaFieldDetail, Region,
|
UserRole)
|
||||||
UserRole)
|
from orm.services.customer_manager.cms_rest.data.sql_alchemy.user_role_record import UserRoleRecord
|
||||||
from cms_rest.data.sql_alchemy.user_role_record import UserRoleRecord
|
from orm.services.customer_manager.cms_rest.logic.error_base import ErrorStatus
|
||||||
from cms_rest.logic.error_base import ErrorStatus
|
|
||||||
import oslo_db
|
import oslo_db
|
||||||
from oslo_db.sqlalchemy import session as db_session
|
from oslo_db.sqlalchemy import session as db_session
|
||||||
from pecan import conf
|
from pecan import conf
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
from cms_rest.data.sql_alchemy.models import CmsUser
|
from orm.services.customer_manager.cms_rest.data.sql_alchemy.models import CmsUser
|
||||||
from cms_rest.logger import get_logger
|
from orm.services.customer_manager.cms_rest.logger import get_logger
|
||||||
|
|
||||||
LOG = get_logger(__name__)
|
LOG = get_logger(__name__)
|
||||||
|
|
||||||
|
@@ -1,11 +1,12 @@
|
|||||||
from __builtin__ import int
|
from __builtin__ import int
|
||||||
|
|
||||||
from cms_rest.data.sql_alchemy.models import (CmsUser, Customer,
|
|
||||||
CustomerMetadata, CustomerRegion,
|
|
||||||
Region, UserRole)
|
|
||||||
from cms_rest.logger import get_logger
|
|
||||||
from sqlalchemy import func
|
from sqlalchemy import func
|
||||||
|
|
||||||
|
from orm.services.customer_manager.cms_rest.data.sql_alchemy.models import (CmsUser, Customer,
|
||||||
|
CustomerMetadata, CustomerRegion,
|
||||||
|
Region, UserRole)
|
||||||
|
from orm.services.customer_manager.cms_rest.logger import get_logger
|
||||||
|
|
||||||
LOG = get_logger(__name__)
|
LOG = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
from cms_rest.data.sql_alchemy.customer_record import CustomerRecord
|
from orm.services.customer_manager.cms_rest.data.sql_alchemy.customer_record import CustomerRecord
|
||||||
from cms_rest.data.sql_alchemy.models import CustomerRegion
|
from orm.services.customer_manager.cms_rest.data.sql_alchemy.models import CustomerRegion
|
||||||
from cms_rest.data.sql_alchemy.region_record import RegionRecord
|
from orm.services.customer_manager.cms_rest.data.sql_alchemy.region_record import RegionRecord
|
||||||
from cms_rest.logger import get_logger
|
from orm.services.customer_manager.cms_rest.logger import get_logger
|
||||||
|
|
||||||
LOG = get_logger(__name__)
|
LOG = get_logger(__name__)
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
from cms_rest.data.sql_alchemy.base import Base
|
from orm.services.customer_manager.cms_rest.data.sql_alchemy.base import Base
|
||||||
import cms_rest.model.Models as WsmeModels
|
import orm.services.customer_manager.cms_rest.model.Models as WsmeModels
|
||||||
from oslo_db.sqlalchemy import models
|
from oslo_db.sqlalchemy import models
|
||||||
|
|
||||||
from sqlalchemy import Column, ForeignKey, Integer, SmallInteger, String
|
from sqlalchemy import Column, ForeignKey, Integer, SmallInteger, String
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
from cms_rest.data.sql_alchemy.models import Region
|
from orm.services.customer_manager.cms_rest.data.sql_alchemy.models import Region
|
||||||
from cms_rest.logger import get_logger
|
from orm.services.customer_manager.cms_rest.logger import get_logger
|
||||||
|
|
||||||
LOG = get_logger(__name__)
|
LOG = get_logger(__name__)
|
||||||
|
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
from cms_rest.data.sql_alchemy.cms_user_record import CmsUserRecord
|
from orm.services.customer_manager.cms_rest.data.sql_alchemy.cms_user_record import CmsUserRecord
|
||||||
from cms_rest.data.sql_alchemy.customer_record import CustomerRecord
|
from orm.services.customer_manager.cms_rest.data.sql_alchemy.customer_record import CustomerRecord
|
||||||
from cms_rest.data.sql_alchemy.models import *
|
from orm.services.customer_manager.cms_rest.data.sql_alchemy.models import *
|
||||||
from cms_rest.data.sql_alchemy.region_record import RegionRecord
|
from orm.services.customer_manager.cms_rest.data.sql_alchemy.region_record import RegionRecord
|
||||||
from cms_rest.logger import get_logger
|
from orm.services.customer_manager.cms_rest.logger import get_logger
|
||||||
from cms_rest.logic.error_base import NotFound
|
from orm.services.customer_manager.cms_rest.logic.error_base import NotFound
|
||||||
|
|
||||||
LOG = get_logger(__name__)
|
LOG = get_logger(__name__)
|
||||||
|
|
||||||
|
@@ -1,19 +1,19 @@
|
|||||||
import requests
|
|
||||||
|
|
||||||
from cms_rest.data.data_manager import DataManager
|
|
||||||
from cms_rest.data.sql_alchemy.models import CustomerMetadata, UserRole
|
|
||||||
from cms_rest.logger import get_logger
|
|
||||||
from cms_rest.logic.error_base import (DuplicateEntryError, ErrorStatus,
|
|
||||||
NotFound)
|
|
||||||
from cms_rest.model.Models import (CustomerResultWrapper, CustomerSummary,
|
|
||||||
CustomerSummaryResponse,
|
|
||||||
RegionResultWrapper, UserResultWrapper)
|
|
||||||
from cms_rest.rds_proxy import RdsProxy
|
|
||||||
from orm_common.utils import utils
|
|
||||||
from orm_common.utils.cross_api_utils import (get_regions_of_group,
|
|
||||||
set_utils_conf)
|
|
||||||
import pecan
|
import pecan
|
||||||
from pecan import conf, request
|
from pecan import conf, request
|
||||||
|
import requests
|
||||||
|
|
||||||
|
from orm.common.orm_common.utils import utils
|
||||||
|
from orm.common.orm_common.utils.cross_api_utils import (get_regions_of_group,
|
||||||
|
set_utils_conf)
|
||||||
|
from orm.services.customer_manager.cms_rest.data.data_manager import DataManager
|
||||||
|
from orm.services.customer_manager.cms_rest.data.sql_alchemy.models import CustomerMetadata, UserRole
|
||||||
|
from orm.services.customer_manager.cms_rest.logger import get_logger
|
||||||
|
from orm.services.customer_manager.cms_rest.logic.error_base import (DuplicateEntryError, ErrorStatus,
|
||||||
|
NotFound)
|
||||||
|
from orm.services.customer_manager.cms_rest.model.Models import (CustomerResultWrapper, CustomerSummary,
|
||||||
|
CustomerSummaryResponse,
|
||||||
|
RegionResultWrapper, UserResultWrapper)
|
||||||
|
from orm.services.customer_manager.cms_rest.rds_proxy import RdsProxy
|
||||||
|
|
||||||
LOG = get_logger(__name__)
|
LOG = get_logger(__name__)
|
||||||
|
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
from cms_rest.data.data_manager import DataManager
|
|
||||||
from cms_rest.data.sql_alchemy.models import CustomerMetadata
|
|
||||||
from cms_rest.logger import get_logger
|
|
||||||
from cms_rest.model.Models import CustomerResultWrapper
|
|
||||||
from cms_rest.rds_proxy import RdsProxy
|
|
||||||
from orm_common.utils import utils
|
|
||||||
from pecan import request
|
from pecan import request
|
||||||
|
|
||||||
|
from orm.common.orm_common.utils import utils
|
||||||
|
from orm.services.customer_manager.cms_rest.data.data_manager import DataManager
|
||||||
|
from orm.services.customer_manager.cms_rest.data.sql_alchemy.models import CustomerMetadata
|
||||||
|
from orm.services.customer_manager.cms_rest.logger import get_logger
|
||||||
|
from orm.services.customer_manager.cms_rest.model.Models import CustomerResultWrapper
|
||||||
|
from orm.services.customer_manager.cms_rest.rds_proxy import RdsProxy
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
from cms_rest.logic.error_base import ErrorStatus
|
from orm.services.customer_manager.cms_rest.logic.error_base import ErrorStatus
|
||||||
from cms_rest.model.Model import Model
|
from orm.services.customer_manager.cms_rest.model.Model import Model
|
||||||
from orm_common.utils.cross_api_utils import (get_regions_of_group,
|
from orm.common.orm_common.utils.cross_api_utils import (get_regions_of_group,
|
||||||
set_utils_conf)
|
set_utils_conf)
|
||||||
from pecan import conf
|
from pecan import conf
|
||||||
import wsme
|
import wsme
|
||||||
from wsme import types as wtypes
|
from wsme import types as wtypes
|
||||||
|
@@ -3,8 +3,8 @@ import pprint
|
|||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from cms_rest.logger import get_logger
|
from orm.services.customer_manager.cms_rest.logger import get_logger
|
||||||
from cms_rest.logic.error_base import ErrorStatus
|
from orm.services.customer_manager.cms_rest.logic.error_base import ErrorStatus
|
||||||
from pecan import conf, request
|
from pecan import conf, request
|
||||||
|
|
||||||
LOG = get_logger(__name__)
|
LOG = get_logger(__name__)
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from keystone_utils import tokens
|
from orm.common.client.keystone.keystone_utils import tokens
|
||||||
from orm_common.policy import policy
|
from orm.common.orm_common.policy import policy
|
||||||
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 import conf
|
from pecan import conf
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from cms_rest.tests.simple_hook_mock import SimpleHookMock
|
from orm.tests.unit.cms.simple_hook_mock import SimpleHookMock
|
||||||
|
|
||||||
global SimpleHookMock
|
global SimpleHookMock
|
||||||
|
|
||||||
@@ -14,8 +14,8 @@ server = {
|
|||||||
|
|
||||||
# Pecan Application Configurations
|
# Pecan Application Configurations
|
||||||
app = {
|
app = {
|
||||||
'root': 'cms_rest.controllers.root.RootController',
|
'root': 'orm.services.customer_manager.cms_rest.controllers.root.RootController',
|
||||||
'modules': ['cms_rest'],
|
'modules': ['orm.services.customer_manager.cms_rest'],
|
||||||
'static_root': '%(confdir)s/../../public',
|
'static_root': '%(confdir)s/../../public',
|
||||||
'template_path': '%(confdir)s/../templates',
|
'template_path': '%(confdir)s/../templates',
|
||||||
'debug': True,
|
'debug': True,
|
||||||
@@ -127,5 +127,5 @@ authentication = {
|
|||||||
"token_role": "admin",
|
"token_role": "admin",
|
||||||
"role_location": {"tenant": "admin"},
|
"role_location": {"tenant": "admin"},
|
||||||
"keystone_version": "2.0",
|
"keystone_version": "2.0",
|
||||||
"policy_file": "cms_rest/etc/policy.json"
|
"policy_file": "orm/services/customer_manager/cms_rest/etc/policy.json"
|
||||||
}
|
}
|
@@ -1,8 +1,9 @@
|
|||||||
from cms_rest.tests import FunctionalTest
|
|
||||||
from cms_rest.utils import authentication
|
|
||||||
import mock
|
import mock
|
||||||
from pecan import conf
|
from pecan import conf
|
||||||
|
|
||||||
|
from orm.services.customer_manager.cms_rest.utils import authentication
|
||||||
|
from orm.tests.unit.cms import FunctionalTest
|
||||||
|
|
||||||
|
|
||||||
class TestUtil(FunctionalTest):
|
class TestUtil(FunctionalTest):
|
||||||
|
|
||||||
@@ -10,14 +11,14 @@ class TestUtil(FunctionalTest):
|
|||||||
FunctionalTest.setUp(self)
|
FunctionalTest.setUp(self)
|
||||||
self.mock_response = mock.Mock()
|
self.mock_response = mock.Mock()
|
||||||
|
|
||||||
@mock.patch('keystone_utils.tokens.TokenConf')
|
@mock.patch('orm.common.client.keystone.keystone_utils.tokens.TokenConf')
|
||||||
def test_get_token_conf(self, mock_TokenConf):
|
def test_get_token_conf(self, mock_TokenConf):
|
||||||
mock_TokenConf.return_value = 123
|
mock_TokenConf.return_value = 123
|
||||||
token_conf = authentication._get_token_conf(conf)
|
token_conf = authentication._get_token_conf(conf)
|
||||||
self.assertEqual(token_conf, 123)
|
self.assertEqual(token_conf, 123)
|
||||||
|
|
||||||
@mock.patch('keystone_utils.tokens.is_token_valid')
|
@mock.patch('orm.common.client.keystone.keystone_utils.tokens.is_token_valid')
|
||||||
@mock.patch('keystone_utils.tokens.TokenConf')
|
@mock.patch('orm.common.client.keystone.keystone_utils.tokens.TokenConf')
|
||||||
def test_check_permissions_token_valid(self, mock_get_token_conf, mock_is_token_valid):
|
def test_check_permissions_token_valid(self, mock_get_token_conf, mock_is_token_valid):
|
||||||
setattr(conf.authentication, 'enabled', True)
|
setattr(conf.authentication, 'enabled', True)
|
||||||
mock_get_token_conf.return_value = 123
|
mock_get_token_conf.return_value = 123
|
||||||
@@ -25,8 +26,8 @@ class TestUtil(FunctionalTest):
|
|||||||
is_permitted = authentication.check_permissions(conf, 'asher', 0)
|
is_permitted = authentication.check_permissions(conf, 'asher', 0)
|
||||||
self.assertEqual(is_permitted, True)
|
self.assertEqual(is_permitted, True)
|
||||||
|
|
||||||
@mock.patch('keystone_utils.tokens.is_token_valid')
|
@mock.patch('orm.common.client.keystone.keystone_utils.tokens.is_token_valid')
|
||||||
@mock.patch('keystone_utils.tokens.TokenConf')
|
@mock.patch('orm.common.client.keystone.keystone_utils.tokens.TokenConf')
|
||||||
def test_check_permissions_token_invalid(self, mock_get_token_conf, mock_is_token_valid):
|
def test_check_permissions_token_invalid(self, mock_get_token_conf, mock_is_token_valid):
|
||||||
setattr(conf.authentication, 'enabled', True)
|
setattr(conf.authentication, 'enabled', True)
|
||||||
mock_get_token_conf.return_value = 123
|
mock_get_token_conf.return_value = 123
|
||||||
@@ -34,8 +35,8 @@ class TestUtil(FunctionalTest):
|
|||||||
is_permitted = authentication.check_permissions(conf, 'asher', 0)
|
is_permitted = authentication.check_permissions(conf, 'asher', 0)
|
||||||
self.assertEqual(is_permitted, False)
|
self.assertEqual(is_permitted, False)
|
||||||
|
|
||||||
@mock.patch('keystone_utils.tokens.is_token_valid')
|
@mock.patch('orm.common.client.keystone.keystone_utils.tokens.is_token_valid')
|
||||||
@mock.patch('keystone_utils.tokens.TokenConf')
|
@mock.patch('orm.common.client.keystone.keystone_utils.tokens.TokenConf')
|
||||||
def test_check_permissions_disabled(self, mock_get_token_conf, mock_is_token_valid):
|
def test_check_permissions_disabled(self, mock_get_token_conf, mock_is_token_valid):
|
||||||
setattr(conf.authentication, 'enabled', False)
|
setattr(conf.authentication, 'enabled', False)
|
||||||
mock_get_token_conf.return_value = 123
|
mock_get_token_conf.return_value = 123
|
||||||
@@ -43,8 +44,8 @@ class TestUtil(FunctionalTest):
|
|||||||
is_permitted = authentication.check_permissions(conf, 'asher', 0)
|
is_permitted = authentication.check_permissions(conf, 'asher', 0)
|
||||||
self.assertEqual(is_permitted, True)
|
self.assertEqual(is_permitted, True)
|
||||||
|
|
||||||
@mock.patch('keystone_utils.tokens.is_token_valid')
|
@mock.patch('orm.common.client.keystone.keystone_utils.tokens.is_token_valid')
|
||||||
@mock.patch('keystone_utils.tokens.TokenConf')
|
@mock.patch('orm.common.client.keystone.keystone_utils.tokens.TokenConf')
|
||||||
def test_check_permissions_is_token_valid_breaks(self, mock_get_token_conf, mock_is_token_valid):
|
def test_check_permissions_is_token_valid_breaks(self, mock_get_token_conf, mock_is_token_valid):
|
||||||
setattr(conf.authentication, 'enabled', True)
|
setattr(conf.authentication, 'enabled', True)
|
||||||
mock_is_token_valid.side_effect = Exception('boom')
|
mock_is_token_valid.side_effect = Exception('boom')
|
@@ -1,12 +1,13 @@
|
|||||||
"""Get configuration module unittests."""
|
"""Get configuration module unittests."""
|
||||||
from cms_rest.tests import FunctionalTest
|
|
||||||
from mock import patch
|
from mock import patch
|
||||||
|
|
||||||
|
from orm.tests.unit.cms import FunctionalTest
|
||||||
|
|
||||||
|
|
||||||
class TestGetConfiguration(FunctionalTest):
|
class TestGetConfiguration(FunctionalTest):
|
||||||
"""Main get configuration test case."""
|
"""Main get configuration test case."""
|
||||||
|
|
||||||
@patch('orm_common.utils.utils.report_config')
|
@patch('orm.common.orm_common.utils.utils.report_config')
|
||||||
def test_get_configuration_success(self, mock_report):
|
def test_get_configuration_success(self, mock_report):
|
||||||
"""Test get_configuration returns the expected value on success."""
|
"""Test get_configuration returns the expected value on success."""
|
||||||
mock_report.return_value = '12345'
|
mock_report.return_value = '12345'
|
@@ -1,9 +1,9 @@
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
from cms_rest.controllers.v1.orm.customer import root
|
from orm.services.customer_manager.cms_rest.controllers.v1.orm.customer import root
|
||||||
from cms_rest.logic.error_base import ErrorStatus
|
from orm.services.customer_manager.cms_rest.logic.error_base import ErrorStatus
|
||||||
from cms_rest.model import Models
|
from orm.services.customer_manager.cms_rest.model import Models
|
||||||
from cms_rest.tests import FunctionalTest, test_utils
|
from orm.tests.unit.cms import FunctionalTest, test_utils
|
||||||
import mock
|
import mock
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
from wsme.exc import ClientSideError
|
from wsme.exc import ClientSideError
|
@@ -1,8 +1,8 @@
|
|||||||
from cms_rest.data.sql_alchemy import models as sql_models
|
from orm.services.customer_manager.cms_rest.data.sql_alchemy import models as sql_models
|
||||||
from cms_rest.logic import customer_logic
|
from orm.services.customer_manager.cms_rest.logic import customer_logic
|
||||||
from cms_rest.logic.error_base import ErrorStatus
|
from orm.services.customer_manager.cms_rest.logic.error_base import ErrorStatus
|
||||||
import cms_rest.model.Models as models
|
import orm.services.customer_manager.cms_rest.model.Models as models
|
||||||
from cms_rest.tests import FunctionalTest
|
from orm.tests.unit.cms import FunctionalTest
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
@@ -1,10 +1,10 @@
|
|||||||
|
import mock
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from cms_rest.controllers.v1.orm.customer import enabled
|
from orm.services.customer_manager.cms_rest.controllers.v1.orm.customer import enabled
|
||||||
from cms_rest.logic.error_base import ErrorStatus
|
from orm.services.customer_manager.cms_rest.logic.error_base import ErrorStatus
|
||||||
from cms_rest.model import Models
|
from orm.services.customer_manager.cms_rest.model import Models
|
||||||
from cms_rest.tests import FunctionalTest
|
from orm.tests.unit.cms import FunctionalTest
|
||||||
import mock
|
|
||||||
|
|
||||||
customer_logic_mock = None
|
customer_logic_mock = None
|
||||||
|
|
@@ -1,10 +1,10 @@
|
|||||||
|
import mock
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from cms_rest.controllers.v1.orm.customer import metadata
|
from orm.services.customer_manager.cms_rest.controllers.v1.orm.customer import metadata
|
||||||
from cms_rest.logic.error_base import ErrorStatus
|
from orm.services.customer_manager.cms_rest.logic.error_base import ErrorStatus
|
||||||
from cms_rest.model import Models
|
from orm.services.customer_manager.cms_rest.model import Models
|
||||||
from cms_rest.tests import FunctionalTest
|
from orm.tests.unit.cms import FunctionalTest
|
||||||
import mock
|
|
||||||
|
|
||||||
metadata_logic_mock = None
|
metadata_logic_mock = None
|
||||||
|
|
@@ -1,7 +1,8 @@
|
|||||||
from cms_rest.model import Models as models
|
|
||||||
from cms_rest.tests import FunctionalTest
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
|
from orm.services.customer_manager.cms_rest.model import Models as models
|
||||||
|
from orm.tests.unit.cms import FunctionalTest
|
||||||
|
|
||||||
GROUP_REGIONS = [
|
GROUP_REGIONS = [
|
||||||
"DPK",
|
"DPK",
|
||||||
"SNA1",
|
"SNA1",
|
@@ -1,10 +1,11 @@
|
|||||||
from cms_rest.data.sql_alchemy import models
|
|
||||||
from cms_rest.logic.error_base import ErrorStatus
|
|
||||||
from cms_rest import rds_proxy
|
|
||||||
from cms_rest.tests import FunctionalTest
|
|
||||||
import mock
|
import mock
|
||||||
from testfixtures import log_capture
|
from testfixtures import log_capture
|
||||||
|
|
||||||
|
from orm.services.customer_manager.cms_rest.data.sql_alchemy import models
|
||||||
|
from orm.services.customer_manager.cms_rest.logic.error_base import ErrorStatus
|
||||||
|
from orm.services.customer_manager.cms_rest import rds_proxy
|
||||||
|
from orm.tests.unit.cms import FunctionalTest
|
||||||
|
|
||||||
|
|
||||||
class Response:
|
class Response:
|
||||||
def __init__(self, status_code, content):
|
def __init__(self, status_code, content):
|
||||||
@@ -22,7 +23,7 @@ class TestUtil(FunctionalTest):
|
|||||||
|
|
||||||
@mock.patch.object(rds_proxy, 'request')
|
@mock.patch.object(rds_proxy, 'request')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
@log_capture('cms_rest.rds_proxy')
|
@log_capture('orm.services.customer_manager.cms_rest.rds_proxy')
|
||||||
def test_send_good(self, mock_post, mock_request, l):
|
def test_send_good(self, mock_post, mock_request, l):
|
||||||
resp = Response(200, 'my content')
|
resp = Response(200, 'my content')
|
||||||
mock_post.return_value = resp
|
mock_post.return_value = resp
|
||||||
@@ -33,7 +34,7 @@ class TestUtil(FunctionalTest):
|
|||||||
|
|
||||||
@mock.patch.object(rds_proxy, 'request')
|
@mock.patch.object(rds_proxy, 'request')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
@log_capture('cms_rest.rds_proxy')
|
@log_capture('orm.services.customer_manager.cms_rest.rds_proxy')
|
||||||
def test_bad_status(self, mock_post, mock_request, l):
|
def test_bad_status(self, mock_post, mock_request, l):
|
||||||
resp = Response(400, 'my content')
|
resp = Response(400, 'my content')
|
||||||
mock_post.return_value = resp
|
mock_post.return_value = resp
|
||||||
@@ -43,7 +44,7 @@ class TestUtil(FunctionalTest):
|
|||||||
|
|
||||||
@mock.patch.object(rds_proxy, 'request')
|
@mock.patch.object(rds_proxy, 'request')
|
||||||
@mock.patch('requests.post')
|
@mock.patch('requests.post')
|
||||||
@log_capture('cms_rest.rds_proxy')
|
@log_capture('orm.services.customer_manager.cms_rest.rds_proxy')
|
||||||
def test_no_content(self, mock_post, mock_request, l):
|
def test_no_content(self, mock_post, mock_request, l):
|
||||||
resp = Response(200, None)
|
resp = Response(200, None)
|
||||||
mock_post.return_value = resp
|
mock_post.return_value = resp
|
@@ -1,12 +1,12 @@
|
|||||||
import requests
|
|
||||||
|
|
||||||
from cms_rest.controllers.v1.orm.customer import regions
|
|
||||||
from cms_rest.logic.error_base import ErrorStatus
|
|
||||||
from cms_rest.model import Models
|
|
||||||
from cms_rest.tests import FunctionalTest
|
|
||||||
import mock
|
import mock
|
||||||
|
import requests
|
||||||
from wsme.exc import ClientSideError
|
from wsme.exc import ClientSideError
|
||||||
|
|
||||||
|
from orm.services.customer_manager.cms_rest.controllers.v1.orm.customer import regions
|
||||||
|
from orm.services.customer_manager.cms_rest.logic.error_base import ErrorStatus
|
||||||
|
from orm.services.customer_manager.cms_rest.model import Models
|
||||||
|
from orm.tests.unit.cms import FunctionalTest
|
||||||
|
|
||||||
customer_logic_mock = None
|
customer_logic_mock = None
|
||||||
|
|
||||||
|
|
@@ -1,12 +1,12 @@
|
|||||||
import requests
|
|
||||||
|
|
||||||
from cms_rest.controllers.v1.orm.customer import users
|
|
||||||
from cms_rest.logic.error_base import ErrorStatus
|
|
||||||
from cms_rest.model import Models
|
|
||||||
from cms_rest.tests import FunctionalTest
|
|
||||||
import mock
|
import mock
|
||||||
|
import requests
|
||||||
from wsme.exc import ClientSideError
|
from wsme.exc import ClientSideError
|
||||||
|
|
||||||
|
from orm.services.customer_manager.cms_rest.controllers.v1.orm.customer import users
|
||||||
|
from orm.services.customer_manager.cms_rest.logic.error_base import ErrorStatus
|
||||||
|
from orm.services.customer_manager.cms_rest.model import Models
|
||||||
|
from orm.tests.unit.cms import FunctionalTest
|
||||||
|
|
||||||
customer_logic_mock = None
|
customer_logic_mock = None
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user