from orm.common.orm_common.injector import injector from orm.common.orm_common.utils import api_error_utils as err_utils from orm.services.flavor_manager.fms_rest.data.wsme.models import TenantWrapper from orm.services.flavor_manager.fms_rest.logger import get_logger from orm.services.flavor_manager.fms_rest.logic.error_base import ErrorStatus from orm.services.flavor_manager.fms_rest.utils import authentication from pecan import request, rest from wsmeext.pecan import wsexpose LOG = get_logger(__name__) di = injector.get_di() @di.dependsOn('flavor_logic') @di.dependsOn('utils') class TenantController(rest.RestController): @wsexpose(TenantWrapper, str, body=TenantWrapper, rest_content_types='json', status_code=201) def post(self, flavor_id, tenant_wrapper): flavor_logic, utils = di.resolver.unpack(TenantController) LOG.info("TenantController - add tenants: " + str(tenant_wrapper)) authentication.authorize(request, 'flavor:add_flavor_tenants') try: result = flavor_logic.add_tenants(flavor_id, tenant_wrapper, request.transaction_id)
def test_get_di(self): injector.get_di()