Fix pep8 errors
Fixes existing pep8 errors and reenables the corresponding tox rules Change-Id: I4168a90c40173e4c35c9d75030cd592ace657508
This commit is contained in:
parent
747480367b
commit
7667a7b9af
@ -1,5 +1,5 @@
|
||||
from pecan import make_app
|
||||
from orm import model
|
||||
from pecan import make_app
|
||||
|
||||
|
||||
def setup_app(config):
|
||||
|
@ -1,8 +1,9 @@
|
||||
"""test_get_audits_result module."""
|
||||
|
||||
from audit_client.api.model.get_audits_result import AuditsResult
|
||||
import unittest
|
||||
|
||||
from audit_client.api.model.get_audits_result import AuditsResult
|
||||
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
"""test get audits result class."""
|
||||
|
@ -5,10 +5,9 @@ import threading
|
||||
import unittest
|
||||
import urllib2
|
||||
|
||||
from mock import patch
|
||||
|
||||
from audit_client.api import audit
|
||||
from audit_client.api.exceptions.audit_exception import AuditException
|
||||
from mock import patch
|
||||
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
|
@ -17,8 +17,7 @@
|
||||
|
||||
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
|
||||
|
||||
from setuptools import find_packages
|
||||
from setuptools import setup
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
setup(
|
||||
name='audit_client',
|
||||
|
@ -1,8 +1,8 @@
|
||||
"""keystone_utils token validator unittests."""
|
||||
import mock
|
||||
import unittest
|
||||
|
||||
from keystone_utils import tokens
|
||||
import mock
|
||||
|
||||
|
||||
class MyResponse(object):
|
||||
@ -191,7 +191,7 @@ class TokensTest(unittest.TestCase):
|
||||
tokens.get_token_user, 'a', mock.MagicMock(), 'c')
|
||||
|
||||
def test_get_token_user_invalid_keystone_version(self):
|
||||
conf = tokens.TokenConf(*(None,)*5)
|
||||
conf = tokens.TokenConf(*(None,) * 5)
|
||||
self.assertRaises(ValueError, tokens.get_token_user, 'a', conf, 'c',
|
||||
'd')
|
||||
|
||||
@ -200,7 +200,7 @@ class TokensTest(unittest.TestCase):
|
||||
ks = mock.MagicMock()
|
||||
ks.tokens.validate.side_effect = tokens.v3_client.exceptions.NotFound()
|
||||
mock_get_keystone_client.return_value = ks
|
||||
conf = tokens.TokenConf(*('3',)*5)
|
||||
conf = tokens.TokenConf(*('3',) * 5)
|
||||
self.assertIsNone(tokens.get_token_user('a', conf, 'c', 'd'))
|
||||
|
||||
@mock.patch.object(tokens, '_get_keystone_client')
|
||||
@ -212,7 +212,7 @@ class TokensTest(unittest.TestCase):
|
||||
ks.tokens.validate.return_value = token_info
|
||||
mock_get_keystone_client.return_value = ks
|
||||
|
||||
conf = tokens.TokenConf(*('2.0',)*5)
|
||||
conf = tokens.TokenConf(*('2.0',) * 5)
|
||||
result = tokens.get_token_user('a', conf, 'c', 'd')
|
||||
|
||||
self.assertEqual(result.token, 'a')
|
||||
|
@ -1,10 +1,10 @@
|
||||
"""Token utility module."""
|
||||
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
|
||||
|
||||
_verify = False
|
||||
|
@ -1,4 +1,3 @@
|
||||
from keystoneclient import exceptions
|
||||
|
||||
|
||||
class Client(object):
|
||||
|
@ -1,4 +1,3 @@
|
||||
from keystoneclient import exceptions
|
||||
|
||||
|
||||
class Client(object):
|
||||
|
@ -1,4 +1,4 @@
|
||||
from setuptools import setup, find_packages
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
setup(
|
||||
name='keystone_utils',
|
||||
|
@ -1,8 +1,8 @@
|
||||
import json
|
||||
import logging
|
||||
from pecan.hooks import PecanHook
|
||||
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
from pecan.hooks import PecanHook
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import logging
|
||||
|
||||
from pecan.hooks import PecanHook
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -1,6 +1,6 @@
|
||||
from orm_common.utils import utils
|
||||
from pecan import abort
|
||||
from pecan.hooks import PecanHook
|
||||
from orm_common.utils import utils
|
||||
|
||||
|
||||
class TransactionIdHook(PecanHook):
|
||||
|
@ -1,7 +0,0 @@
|
||||
'''
|
||||
'''
|
||||
|
||||
from .di import Di
|
||||
from .dependency_register import DependencyRegister
|
||||
from .resource_provider_register import ResourceProviderRegister
|
||||
from .resolver import DependencyResolver
|
@ -18,8 +18,7 @@ class DependencyRegister:
|
||||
|
||||
@classmethod
|
||||
def _unwrap_func(cls, decorated_func):
|
||||
'''
|
||||
This unwraps a decorated func, returning the inner wrapped func.
|
||||
'''This unwraps a decorated func, returning the inner wrapped func.
|
||||
|
||||
This may become unnecessary with Python 3.4's inspect.unwrap().
|
||||
'''
|
||||
|
@ -1,6 +1,6 @@
|
||||
from .dependency_register import DependencyRegister
|
||||
from .resource_provider_register import ResourceProviderRegister
|
||||
from .resolver import DependencyResolver
|
||||
from .resource_provider_register import ResourceProviderRegister
|
||||
|
||||
|
||||
class Di:
|
||||
|
@ -1,9 +1,7 @@
|
||||
from functools import partial
|
||||
|
||||
from .errors import (
|
||||
FangError,
|
||||
ProviderAlreadyRegisteredError,
|
||||
ProviderNotFoundError)
|
||||
from .errors import (FangError, ProviderAlreadyRegisteredError,
|
||||
ProviderNotFoundError)
|
||||
|
||||
|
||||
class ResourceProviderRegister:
|
||||
|
@ -1,9 +1,9 @@
|
||||
import imp
|
||||
import os
|
||||
|
||||
from orm_common.injector import fang
|
||||
from orm_common.utils.sanitize import sanitize_symbol_name
|
||||
|
||||
import os
|
||||
import imp
|
||||
|
||||
_di = fang.Di()
|
||||
logger = None
|
||||
|
||||
|
@ -19,10 +19,10 @@ import abc
|
||||
import logging
|
||||
|
||||
import six
|
||||
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
from orm_common.utils import dictator
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
registered_checks = {}
|
||||
|
@ -21,10 +21,8 @@ import re
|
||||
import six
|
||||
|
||||
import _checks
|
||||
|
||||
from oslo_policy._i18n import _LE
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -5,10 +5,8 @@ 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 wsme.exc import ClientSideError
|
||||
|
||||
|
||||
import qolicy
|
||||
from wsme.exc import ClientSideError
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
_ENFORCER = None
|
||||
|
@ -218,16 +218,13 @@ desired rule name.
|
||||
import logging
|
||||
import os
|
||||
|
||||
import _parser
|
||||
from oslo_config import cfg
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
|
||||
from oslo_policy import _checks
|
||||
from oslo_policy._i18n import _
|
||||
from oslo_policy import opts
|
||||
|
||||
import _parser
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
import six
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
import json
|
||||
import logging
|
||||
from unittest import TestCase
|
||||
|
||||
import mock
|
||||
from orm_common.hooks import api_error_hook
|
||||
from unittest import TestCase
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
from unittest import TestCase
|
||||
|
||||
import mock
|
||||
from orm_common.hooks import security_headers_hook
|
||||
from unittest import TestCase
|
||||
|
||||
|
||||
class MyHeaders(object):
|
||||
|
@ -1,7 +1,8 @@
|
||||
import logging
|
||||
from unittest import TestCase
|
||||
|
||||
import mock
|
||||
from orm_common.hooks import transaction_id_hook
|
||||
from unittest import TestCase
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import logging
|
||||
import os
|
||||
from unittest import TestCase
|
||||
|
||||
import mock
|
||||
from orm_common.injector import injector
|
||||
from unittest import TestCase
|
||||
import os
|
||||
import logging
|
||||
from orm_common.injector.fang.resource_provider_register import ResourceProviderRegister
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import mock
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
from orm_common.policy import _checks
|
||||
from wsme.exc import ClientSideError
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
import mock
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
from orm_common.policy import policy
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
|
||||
|
||||
class TestException(Exception):
|
||||
|
@ -1,7 +1,8 @@
|
||||
import json
|
||||
from unittest import TestCase
|
||||
|
||||
import mock
|
||||
from orm_common.utils import api_error_utils
|
||||
from unittest import TestCase
|
||||
|
||||
|
||||
class TestCrossApiUtil(TestCase):
|
||||
|
@ -1,12 +1,8 @@
|
||||
import time
|
||||
from unittest import TestCase
|
||||
|
||||
import mock
|
||||
from orm_common.utils import cross_api_utils
|
||||
from testfixtures import log_capture
|
||||
from unittest import TestCase
|
||||
import requests
|
||||
import pecan
|
||||
import logging
|
||||
import pprint
|
||||
import time
|
||||
|
||||
|
||||
class TestCrossApiUtil(TestCase):
|
||||
|
@ -1,11 +1,10 @@
|
||||
import logging
|
||||
import pprint
|
||||
from unittest import TestCase
|
||||
|
||||
import mock
|
||||
from orm_common.utils import utils
|
||||
from testfixtures import log_capture
|
||||
from unittest import TestCase
|
||||
import requests
|
||||
import pecan
|
||||
import logging
|
||||
import pprint
|
||||
|
||||
|
||||
class TestUtil(TestCase):
|
||||
|
@ -1,4 +1,5 @@
|
||||
import json
|
||||
|
||||
from orm_common.utils import utils
|
||||
from wsme.exc import ClientSideError
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
import requests
|
||||
import logging
|
||||
from pecan import conf
|
||||
from audit_client.api import audit
|
||||
import time
|
||||
|
||||
import requests
|
||||
|
||||
from pecan import conf
|
||||
|
||||
# from orm_common.logger import get_logger
|
||||
|
||||
# logger = get_logger(__name__)
|
||||
|
@ -1,9 +1,11 @@
|
||||
import requests
|
||||
import logging
|
||||
from pecan import conf
|
||||
from audit_client.api import audit
|
||||
import time
|
||||
import pprint
|
||||
import time
|
||||
|
||||
import requests
|
||||
|
||||
from audit_client.api import audit
|
||||
from pecan import conf
|
||||
|
||||
# from cms_rest.logger import get_logger
|
||||
#
|
||||
@ -218,8 +220,7 @@ def get_resource_status(resource_id):
|
||||
|
||||
|
||||
def get_time_human():
|
||||
"""
|
||||
this function return the timestamp for output JSON
|
||||
"""this function return the timestamp for output JSON
|
||||
:return: timestamp in wanted format
|
||||
"""
|
||||
return time.strftime("%a, %b %d %Y, %X (%Z)", time.gmtime())
|
||||
|
@ -2,10 +2,10 @@
|
||||
import logging
|
||||
import os
|
||||
|
||||
from pecan import make_app
|
||||
from pecan.commands import CommandRunner
|
||||
from audit_server import model
|
||||
from audit_server.storage import factory
|
||||
from pecan.commands import CommandRunner
|
||||
from pecan import make_app
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -32,4 +32,4 @@ def main():
|
||||
drive, path_and_file = os.path.splitdrive(dir_name)
|
||||
path, filename = os.path.split(path_and_file)
|
||||
runner = CommandRunner()
|
||||
runner.run(['serve', path+'/config.py'])
|
||||
runner.run(['serve', path + '/config.py'])
|
||||
|
@ -1,8 +1,6 @@
|
||||
"""audit controller module."""
|
||||
|
||||
from audit_server.controllers.v1 import configuration
|
||||
from audit_server.controllers.v1 import logs
|
||||
from audit_server.controllers.v1 import transaction
|
||||
from audit_server.controllers.v1 import configuration, logs, transaction
|
||||
|
||||
|
||||
class AuditController(object):
|
||||
|
@ -1,28 +1,28 @@
|
||||
"""Configuration rest API input module."""
|
||||
|
||||
import logging
|
||||
from orm_common.utils import utils
|
||||
from pecan import conf
|
||||
from pecan import rest
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ConfigurationController(rest.RestController):
|
||||
"""Configuration controller."""
|
||||
|
||||
@wsexpose(str, str, status_code=200)
|
||||
def get(self, dump_to_log='false'):
|
||||
"""get method.
|
||||
|
||||
:param dump_to_log: A boolean string that says whether the
|
||||
configuration should be written to log
|
||||
:return: A pretty string that contains the service's configuration
|
||||
"""
|
||||
logger.info("Get configuration...")
|
||||
|
||||
dump = dump_to_log.lower() == 'true'
|
||||
utils.set_utils_conf(conf)
|
||||
result = utils.report_config(conf, dump, logger)
|
||||
return result
|
||||
"""Configuration rest API input module."""
|
||||
|
||||
import logging
|
||||
|
||||
from orm_common.utils import utils
|
||||
from pecan import conf, rest
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ConfigurationController(rest.RestController):
|
||||
"""Configuration controller."""
|
||||
|
||||
@wsexpose(str, str, status_code=200)
|
||||
def get(self, dump_to_log='false'):
|
||||
"""get method.
|
||||
|
||||
:param dump_to_log: A boolean string that says whether the
|
||||
configuration should be written to log
|
||||
:return: A pretty string that contains the service's configuration
|
||||
"""
|
||||
logger.info("Get configuration...")
|
||||
|
||||
dump = dump_to_log.lower() == 'true'
|
||||
utils.set_utils_conf(conf)
|
||||
result = utils.report_config(conf, dump, logger)
|
||||
return result
|
||||
|
@ -1,7 +1,7 @@
|
||||
import logging
|
||||
import wsme
|
||||
|
||||
from pecan import rest
|
||||
import wsme
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -1,16 +1,16 @@
|
||||
"""transaction controller module."""
|
||||
|
||||
import base
|
||||
import logging
|
||||
import wsme
|
||||
|
||||
from audit_server.model.transaction import Model as TransactionModel
|
||||
from audit_server.model.transaction_query import Model as QueryModel
|
||||
from audit_server.services import transaction as transaction_service
|
||||
import base
|
||||
import logging
|
||||
from pecan import rest
|
||||
import wsme
|
||||
from wsme import types as wtypes
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
"""Utils module mock."""
|
||||
|
||||
|
||||
def report_config(conf, dump=False):
|
||||
"""Mock report_config function."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
def set_utils_conf(conf):
|
||||
"""Mock set_utils_conf function."""
|
||||
|
||||
pass
|
||||
"""Utils module mock."""
|
||||
|
||||
|
||||
def report_config(conf, dump=False):
|
||||
"""Mock report_config function."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
def set_utils_conf(conf):
|
||||
"""Mock set_utils_conf function."""
|
||||
|
||||
pass
|
||||
|
@ -2,15 +2,13 @@
|
||||
|
||||
import logging
|
||||
|
||||
from sqlalchemy import Column, Integer, Text, BigInteger, asc
|
||||
from sqlalchemy import create_engine
|
||||
from audit_server.model.transaction import Model
|
||||
from audit_server.storage import transaction
|
||||
from sqlalchemy import BigInteger, Column, Integer, Text, asc, create_engine
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
from sqlalchemy.ext.declarative.api import declarative_base
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
from audit_server.model.transaction import Model
|
||||
from audit_server.storage import transaction
|
||||
|
||||
Base = declarative_base()
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
"""Base classes for API tests."""
|
||||
|
||||
import unittest
|
||||
|
||||
import pecan
|
||||
import pecan.testing
|
||||
import unittest
|
||||
|
||||
|
||||
class FunctionalTest(unittest.TestCase):
|
||||
|
@ -1,11 +1,12 @@
|
||||
"""test_base module."""
|
||||
|
||||
|
||||
from audit_server.controllers.v1.base import ClientSideError
|
||||
from audit_server.controllers.v1.base import EntityNotFoundError
|
||||
from audit_server.controllers.v1.base import InputValueError
|
||||
import unittest
|
||||
|
||||
from audit_server.controllers.v1.base import (ClientSideError,
|
||||
EntityNotFoundError,
|
||||
InputValueError)
|
||||
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
"""test case class."""
|
||||
|
@ -1,14 +1,14 @@
|
||||
"""Get configuration module unittests."""
|
||||
from audit_server.controllers.v1 import configuration as root
|
||||
from audit_server.tests.controllers.v1.functional_test import FunctionalTest
|
||||
from mock import patch
|
||||
|
||||
|
||||
class TestGetConfiguration(FunctionalTest):
|
||||
"""Main get configuration test case."""
|
||||
|
||||
@patch.object(root.utils, 'report_config', return_value='12345')
|
||||
def test_get_configuration_success(self, input):
|
||||
"""Test get_configuration returns the expected value on success."""
|
||||
response = self.app.get('/v1/audit/configuration')
|
||||
self.assertEqual(response.json, '12345')
|
||||
"""Get configuration module unittests."""
|
||||
from audit_server.controllers.v1 import configuration as root
|
||||
from audit_server.tests.controllers.v1.functional_test import FunctionalTest
|
||||
from mock import patch
|
||||
|
||||
|
||||
class TestGetConfiguration(FunctionalTest):
|
||||
"""Main get configuration test case."""
|
||||
|
||||
@patch.object(root.utils, 'report_config', return_value='12345')
|
||||
def test_get_configuration_success(self, input):
|
||||
"""Test get_configuration returns the expected value on success."""
|
||||
response = self.app.get('/v1/audit/configuration')
|
||||
self.assertEqual(response.json, '12345')
|
||||
|
@ -1,25 +1,25 @@
|
||||
"""Logs module unittests."""
|
||||
from audit_server.tests.controllers.v1.functional_test import FunctionalTest
|
||||
|
||||
|
||||
class TestLogs(FunctionalTest):
|
||||
"""logs tests."""
|
||||
|
||||
def test_change_log_level_fail(self):
|
||||
response = self.app.put('/v1/audit/logs/1')
|
||||
expected_result = {
|
||||
"result": "Fail to change log_level. Reason: "
|
||||
"The given log level [1] doesn't exist."}
|
||||
self.assertEqual(expected_result, response.json)
|
||||
|
||||
def test_change_log_level_none(self):
|
||||
response = self.app.put('/v1/audit/logs', expect_errors=True)
|
||||
expected_result = 'Missing argument: "level"'
|
||||
self.assertEqual(response.json["faultstring"], expected_result)
|
||||
self.assertEqual(response.status_code, 400)
|
||||
|
||||
def test_change_log_level_success(self):
|
||||
response = self.app.put('/v1/audit/logs/debug')
|
||||
expected_result = {'result': 'Log level changed to debug.'}
|
||||
self.assertEqual(response.json, expected_result)
|
||||
self.assertEqual(response.status_code, 201)
|
||||
"""Logs module unittests."""
|
||||
from audit_server.tests.controllers.v1.functional_test import FunctionalTest
|
||||
|
||||
|
||||
class TestLogs(FunctionalTest):
|
||||
"""logs tests."""
|
||||
|
||||
def test_change_log_level_fail(self):
|
||||
response = self.app.put('/v1/audit/logs/1')
|
||||
expected_result = {
|
||||
"result": "Fail to change log_level. Reason: "
|
||||
"The given log level [1] doesn't exist."}
|
||||
self.assertEqual(expected_result, response.json)
|
||||
|
||||
def test_change_log_level_none(self):
|
||||
response = self.app.put('/v1/audit/logs', expect_errors=True)
|
||||
expected_result = 'Missing argument: "level"'
|
||||
self.assertEqual(response.json["faultstring"], expected_result)
|
||||
self.assertEqual(response.status_code, 400)
|
||||
|
||||
def test_change_log_level_success(self):
|
||||
response = self.app.put('/v1/audit/logs/debug')
|
||||
expected_result = {'result': 'Log level changed to debug.'}
|
||||
self.assertEqual(response.json, expected_result)
|
||||
self.assertEqual(response.status_code, 201)
|
||||
|
@ -1,14 +1,13 @@
|
||||
"""test_transaction module."""
|
||||
|
||||
|
||||
from mock import patch
|
||||
|
||||
from audit_server.controllers.v1.transaction import QueryResult
|
||||
from audit_server.model.transaction import Model as TransactionModel
|
||||
from audit_server.model.transaction_query_result import \
|
||||
Model as TransactionQueryResultModel
|
||||
from audit_server.services import transaction as transaction_service
|
||||
from audit_server.tests.controllers.v1.functional_test import FunctionalTest
|
||||
from mock import patch
|
||||
|
||||
|
||||
class Test(FunctionalTest):
|
||||
|
@ -1,9 +1,10 @@
|
||||
"""test_base module."""
|
||||
|
||||
|
||||
from audit_server.services.base import Error
|
||||
import unittest
|
||||
|
||||
from audit_server.services.base import Error
|
||||
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
"""test base class."""
|
||||
|
@ -2,12 +2,11 @@
|
||||
|
||||
import unittest
|
||||
|
||||
from mock import patch
|
||||
|
||||
from audit_server.model.transaction import Model as TransactionModel
|
||||
from audit_server.model.transaction_query import Model as TransactionQuery
|
||||
from audit_server.services import transaction as TransactionService
|
||||
from audit_server.storage import factory
|
||||
from mock import patch
|
||||
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
|
@ -2,18 +2,15 @@
|
||||
|
||||
import unittest
|
||||
|
||||
from audit_server.model.transaction import Model as TransactionModel
|
||||
from audit_server.model.transaction_query import Model as TransactionQueryModel
|
||||
from audit_server.storage.mysql.transaction import Connection, Record
|
||||
from mock import patch
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
|
||||
from audit_server.model.transaction import Model as TransactionModel
|
||||
from audit_server.model.transaction_query import Model as TransactionQueryModel
|
||||
from audit_server.storage.mysql.transaction import Connection
|
||||
from audit_server.storage.mysql.transaction import Record
|
||||
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
"""test transaction class."""
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
"""test_factory module."""
|
||||
|
||||
import unittest
|
||||
|
||||
from audit_server.storage import factory
|
||||
from audit_server.storage.mysql.transaction import Connection
|
||||
from mock import patch
|
||||
from sqlalchemy import create_engine
|
||||
import unittest
|
||||
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
|
@ -1,9 +1,10 @@
|
||||
"""test_transaction module."""
|
||||
|
||||
|
||||
from audit_server.storage.transaction import Base
|
||||
import unittest
|
||||
|
||||
from audit_server.storage.transaction import Base
|
||||
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
"""test transaction class."""
|
||||
|
@ -1,12 +1,13 @@
|
||||
from pecan import make_app
|
||||
from cms_rest import model
|
||||
from orm_common.utils import utils
|
||||
from cms_rest.logger import get_logger
|
||||
from pecan.commands import CommandRunner
|
||||
from orm_common.policy import policy
|
||||
from cms_rest.utils import authentication
|
||||
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 import make_app
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
@ -33,4 +34,4 @@ def main():
|
||||
drive, path_and_file = os.path.splitdrive(dir_name)
|
||||
path, filename = os.path.split(path_and_file)
|
||||
runner = CommandRunner()
|
||||
runner.run(['serve', path+'/config.py'])
|
||||
runner.run(['serve', path + '/config.py'])
|
||||
|
@ -1,9 +1,5 @@
|
||||
from pecan import expose, request, response
|
||||
from webob.exc import status_map
|
||||
from pecan.secure import SecureController
|
||||
from cms_rest.controllers.v1 import root as v1
|
||||
from cms_rest.utils import authentication
|
||||
from pecan import conf
|
||||
from pecan import expose
|
||||
|
||||
|
||||
class RootController(object):
|
||||
@ -12,8 +8,7 @@ class RootController(object):
|
||||
|
||||
@expose(template='json')
|
||||
def _default(self):
|
||||
"""
|
||||
Method to handle GET /
|
||||
"""Method to handle GET /
|
||||
parameters: None
|
||||
return: dict describing cms rest version information
|
||||
"""
|
||||
|
@ -1,7 +1,6 @@
|
||||
import wsme
|
||||
from pecan import response
|
||||
import wsme
|
||||
from wsme import types as wtypes
|
||||
import inspect
|
||||
|
||||
|
||||
class ClientSideError(wsme.exc.ClientSideError):
|
||||
|
@ -1,11 +1,10 @@
|
||||
"""Configuration rest API input module."""
|
||||
|
||||
import logging
|
||||
from orm_common.utils import utils
|
||||
from pecan import conf
|
||||
from pecan import rest
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
from orm_common.utils import utils
|
||||
from pecan import conf, rest
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -1,14 +1,13 @@
|
||||
from pecan import rest, request
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
from orm_common.utils import utils
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
from cms_rest.model.Models import Enabled, CustomerResultWrapper
|
||||
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 wsmeext.pecan import wsexpose
|
||||
|
||||
from cms_rest.logger import get_logger
|
||||
LOG = get_logger(__name__)
|
||||
|
||||
|
||||
|
@ -1,15 +1,13 @@
|
||||
from pecan import rest, request
|
||||
from wsmeext.pecan import wsexpose
|
||||
from cms_rest.model.Models import CustomerResultWrapper
|
||||
from orm_common.utils import utils
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
|
||||
from cms_rest.logic.error_base import ErrorStatus
|
||||
from cms_rest.model.Models import MetadataWrapper
|
||||
import cms_rest.logic.metadata_logic as logic
|
||||
from cms_rest.utils import authentication
|
||||
|
||||
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 wsmeext.pecan import wsexpose
|
||||
|
||||
LOG = get_logger(__name__)
|
||||
|
||||
|
||||
|
@ -1,17 +1,15 @@
|
||||
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 pecan import rest, request
|
||||
from pecan import request, rest
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
from orm_common.utils import utils
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
|
||||
from cms_rest.controllers.v1.orm.customer.users import UserController
|
||||
from cms_rest.model.Models import Region, RegionResultWrapper
|
||||
from cms_rest.logic.customer_logic import CustomerLogic
|
||||
from cms_rest.logic.error_base import ErrorStatus, DuplicateEntryError
|
||||
from cms_rest.utils import authentication
|
||||
|
||||
from cms_rest.logger import get_logger
|
||||
LOG = get_logger(__name__)
|
||||
|
||||
|
||||
|
@ -2,17 +2,16 @@ from pecan import rest, request, response
|
||||
import oslo_db
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
from cms_rest.model.Models import Customer, CustomerResultWrapper, CustomerSummaryResponse
|
||||
from cms_rest.controllers.v1.orm.customer.users import DefaultUserController
|
||||
from cms_rest.controllers.v1.orm.customer.regions import RegionController
|
||||
from cms_rest.controllers.v1.orm.customer.metadata import MetadataController
|
||||
from cms_rest.controllers.v1.orm.customer.enabled import EnabledController
|
||||
from cms_rest.controllers.v1.orm.customer.metadata import MetadataController
|
||||
from cms_rest.controllers.v1.orm.customer.regions import RegionController
|
||||
from cms_rest.controllers.v1.orm.customer.users import DefaultUserController
|
||||
from cms_rest.logic.customer_logic import CustomerLogic
|
||||
|
||||
from cms_rest.logic.error_base import ErrorStatus
|
||||
from orm_common.utils import utils
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
from cms_rest.model.Models import Customer, CustomerResultWrapper, CustomerSummaryResponse
|
||||
from cms_rest.utils import authentication
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
from orm_common.utils import utils
|
||||
|
||||
from cms_rest.logger import get_logger
|
||||
|
||||
|
@ -1,15 +1,13 @@
|
||||
from pecan import rest, request
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
from orm_common.utils import utils
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
|
||||
from cms_rest.model.Models import User, UserResultWrapper
|
||||
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 wsmeext.pecan import wsexpose
|
||||
|
||||
from cms_rest.logger import get_logger
|
||||
LOG = get_logger(__name__)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
from cms_rest.controllers.v1.orm.configuration import ConfigurationController
|
||||
from cms_rest.controllers.v1.orm.customer.root import CustomerController
|
||||
from cms_rest.controllers.v1.orm.logs import LogsController
|
||||
from cms_rest.controllers.v1.orm.configuration import ConfigurationController
|
||||
from pecan.rest import RestController
|
||||
|
||||
|
||||
|
@ -1,20 +1,19 @@
|
||||
import oslo_db
|
||||
from oslo_db.sqlalchemy import session as db_session
|
||||
from sqlalchemy.event import listen
|
||||
from sqlalchemy import or_
|
||||
from cms_rest.logic.error_base import ErrorStatus
|
||||
|
||||
from pecan import conf
|
||||
|
||||
import logging
|
||||
|
||||
from cms_rest.data.sql_alchemy.models import CmsRole, CmsUser, Customer, \
|
||||
CustomerRegion, Quota, QuotaFieldDetail, \
|
||||
Region, UserRole
|
||||
from cms_rest.data.sql_alchemy.customer_record import CustomerRecord
|
||||
from cms_rest.data.sql_alchemy.customer_region_record import \
|
||||
CustomerRegionRecord
|
||||
from cms_rest.data.sql_alchemy.models import (CmsRole, CmsUser, Customer,
|
||||
CustomerRegion, Quota,
|
||||
QuotaFieldDetail, Region,
|
||||
UserRole)
|
||||
from cms_rest.data.sql_alchemy.user_role_record import UserRoleRecord
|
||||
from cms_rest.logic.error_base import ErrorStatus
|
||||
import oslo_db
|
||||
from oslo_db.sqlalchemy import session as db_session
|
||||
from pecan import conf
|
||||
from sqlalchemy.event import listen
|
||||
from sqlalchemy import or_
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -1,2 +1,3 @@
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
Base = declarative_base()
|
||||
|
@ -1,6 +1,6 @@
|
||||
from cms_rest.data.sql_alchemy.models import CmsUser
|
||||
|
||||
from cms_rest.logger import get_logger
|
||||
|
||||
LOG = get_logger(__name__)
|
||||
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
from cms_rest.data.sql_alchemy.models import Customer, Region, CustomerRegion, UserRole, CmsUser, CustomerMetadata
|
||||
from sqlalchemy import and_, func
|
||||
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
|
||||
|
||||
LOG = get_logger(__name__)
|
||||
|
||||
@ -85,8 +87,7 @@ class CustomerRecord:
|
||||
raise
|
||||
|
||||
def _build_meta_query(self, metadata):
|
||||
"""
|
||||
build query for having list of metadata
|
||||
"""build query for having list of metadata
|
||||
get list of keys and list of values quereis
|
||||
:param metadata:
|
||||
:return:
|
||||
|
@ -1,7 +1,6 @@
|
||||
from cms_rest.data.sql_alchemy.models import CustomerRegion
|
||||
from cms_rest.data.sql_alchemy.customer_record import CustomerRecord
|
||||
from cms_rest.data.sql_alchemy.models import CustomerRegion
|
||||
from cms_rest.data.sql_alchemy.region_record import RegionRecord
|
||||
|
||||
from cms_rest.logger import get_logger
|
||||
|
||||
LOG = get_logger(__name__)
|
||||
|
@ -1,11 +1,10 @@
|
||||
from sqlalchemy import Column, Integer, String, SmallInteger, ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
from cms_rest.data.sql_alchemy.base import Base
|
||||
import wsme
|
||||
|
||||
import cms_rest.model.Models as WsmeModels
|
||||
from oslo_db.sqlalchemy import models
|
||||
|
||||
import cms_rest.model.Models as WsmeModels
|
||||
from sqlalchemy import Column, ForeignKey, Integer, SmallInteger, String
|
||||
from sqlalchemy.orm import relationship
|
||||
import wsme
|
||||
|
||||
|
||||
class CMSBaseModel(models.ModelBase):
|
||||
|
@ -1,7 +1,6 @@
|
||||
from cms_rest.data.sql_alchemy.models import Region
|
||||
from cms_rest.data.sql_alchemy.customer_record import CustomerRecord
|
||||
|
||||
from cms_rest.logger import get_logger
|
||||
|
||||
LOG = get_logger(__name__)
|
||||
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
from cms_rest.data.sql_alchemy.models import *
|
||||
from cms_rest.data.sql_alchemy.customer_record import CustomerRecord
|
||||
from cms_rest.data.sql_alchemy.cms_user_record import CmsUserRecord
|
||||
from cms_rest.data.sql_alchemy.customer_record import CustomerRecord
|
||||
from cms_rest.data.sql_alchemy.models import *
|
||||
from cms_rest.data.sql_alchemy.region_record import RegionRecord
|
||||
from cms_rest.logger import get_logger
|
||||
from cms_rest.logic.error_base import NotFound
|
||||
|
||||
from cms_rest.logger import get_logger
|
||||
LOG = get_logger(__name__)
|
||||
|
||||
|
||||
|
@ -1,21 +1,19 @@
|
||||
from cms_rest.model.Models import CustomerResultWrapper
|
||||
from cms_rest.model.Models import RegionResultWrapper
|
||||
from cms_rest.model.Models import UserResultWrapper
|
||||
from cms_rest.model.Models import CustomerSummaryResponse, CustomerSummary
|
||||
from cms_rest.rds_proxy import RdsProxy
|
||||
from cms_rest.data.data_manager import DataManager
|
||||
from cms_rest.data.sql_alchemy.models import UserRole
|
||||
from cms_rest.logic.error_base import ErrorStatus, NotFound, DuplicateEntryError
|
||||
from cms_rest.data.sql_alchemy.models import CustomerMetadata
|
||||
from orm_common.utils.cross_api_utils import get_regions_of_group, set_utils_conf
|
||||
from orm_common.utils import utils
|
||||
|
||||
from pecan import conf, request
|
||||
|
||||
import pecan
|
||||
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
|
||||
from pecan import conf, request
|
||||
|
||||
LOG = get_logger(__name__)
|
||||
|
||||
@ -698,8 +696,7 @@ class CustomerLogic(object):
|
||||
|
||||
|
||||
def build_response(customer_uuid, transaction_id, context):
|
||||
"""
|
||||
this function generate th customer action response JSON
|
||||
"""this function generate th customer action response JSON
|
||||
:param customer_uuid:
|
||||
:param transaction_id:
|
||||
:param context: create or update
|
||||
|
@ -1,12 +1,12 @@
|
||||
from cms_rest.data.sql_alchemy.models import CustomerMetadata
|
||||
import json
|
||||
|
||||
from cms_rest.data.data_manager import DataManager
|
||||
from cms_rest.rds_proxy import RdsProxy
|
||||
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 conf
|
||||
import json
|
||||
from cms_rest.logger import get_logger
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
import inspect
|
||||
from wsme import types as wtypes
|
||||
from wsme.rest.json import tojson
|
||||
from wsme import types as wtypes
|
||||
|
||||
|
||||
class Model(wtypes.DynamicBase):
|
||||
|
@ -1,9 +1,10 @@
|
||||
from cms_rest.logic.error_base import ErrorStatus
|
||||
from cms_rest.model.Model import Model
|
||||
from orm_common.utils.cross_api_utils import (get_regions_of_group,
|
||||
set_utils_conf)
|
||||
from pecan import conf
|
||||
import wsme
|
||||
from wsme import types as wtypes
|
||||
from cms_rest.model.Model import Model
|
||||
from cms_rest.logic.error_base import ErrorStatus
|
||||
from pecan import conf
|
||||
from orm_common.utils.cross_api_utils import set_utils_conf, get_regions_of_group
|
||||
|
||||
|
||||
class Enabled(Model):
|
||||
@ -41,8 +42,7 @@ class Compute(Model):
|
||||
vcpus=None, metadata_items=None, injected_file_content_bytes=None,
|
||||
floating_ips='', fixed_ips='', injected_file_path_bytes='',
|
||||
server_groups='', server_group_members=''):
|
||||
"""
|
||||
Create a new compute instance.
|
||||
"""Create a new compute instance.
|
||||
:param instances:
|
||||
:param injected_files:
|
||||
:param key_pairs:
|
||||
@ -91,8 +91,7 @@ class Storage(Model):
|
||||
volumes = wsme.wsattr(wsme.types.text, mandatory=True)
|
||||
|
||||
def __init__(self, gigabytes='', snapshots='', volumes=''):
|
||||
"""
|
||||
create a new Storage instance.
|
||||
"""create a new Storage instance.
|
||||
:param gigabytes:
|
||||
:param snapshots:
|
||||
:param volumes:
|
||||
@ -125,8 +124,7 @@ class Network(Model):
|
||||
health_monitor='', member='', nat_instance='',
|
||||
pool='', route_table='', vip=''):
|
||||
|
||||
"""
|
||||
Create a new Network instance.
|
||||
"""Create a new Network instance.
|
||||
:param floating_ips: num of floating_ips
|
||||
:param networks: num of networks
|
||||
:param ports: num of ports
|
||||
@ -268,8 +266,7 @@ class Customer(Model):
|
||||
self.uuid = uuid
|
||||
|
||||
def validate_model(self, context=None):
|
||||
"""
|
||||
this function check if the customer model meet the demands
|
||||
"""this function check if the customer model meet the demands
|
||||
:param context: i.e. 'create 'update'
|
||||
:return: none
|
||||
"""
|
||||
|
@ -2,8 +2,7 @@ from pecan import conf # noqa
|
||||
|
||||
|
||||
def init_model():
|
||||
"""
|
||||
This is a stub method which is called at application startup time.
|
||||
"""This is a stub method which is called at application startup time.
|
||||
|
||||
If you need to bind to a parsed database configuration, set up tables or
|
||||
ORM classes, or perform any database initialization, this is the
|
||||
|
@ -1,10 +1,11 @@
|
||||
import pprint
|
||||
import requests
|
||||
import json
|
||||
from pecan import conf
|
||||
from pecan import request
|
||||
from cms_rest.logic.error_base import ErrorStatus
|
||||
import pprint
|
||||
|
||||
import requests
|
||||
|
||||
from cms_rest.logger import get_logger
|
||||
from cms_rest.logic.error_base import ErrorStatus
|
||||
from pecan import conf, request
|
||||
|
||||
LOG = get_logger(__name__)
|
||||
headers = {'content-type': 'application/json'}
|
||||
|
@ -1,14 +1,13 @@
|
||||
import os
|
||||
from unittest import TestCase
|
||||
from pecan import set_config
|
||||
from pecan.testing import load_test_app
|
||||
from unittest import TestCase
|
||||
|
||||
__all__ = ['FunctionalTest']
|
||||
|
||||
|
||||
class FunctionalTest(TestCase):
|
||||
"""
|
||||
Used for functional tests where you need to test your
|
||||
"""Used for functional tests where you need to test your
|
||||
literal application and its integration with the framework.
|
||||
"""
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import os
|
||||
|
||||
from cms_rest.tests.simple_hook_mock import SimpleHookMock
|
||||
|
||||
global SimpleHookMock
|
||||
|
@ -1,8 +1,9 @@
|
||||
from cms_rest.data.sql_alchemy import models as sql_models
|
||||
from cms_rest.logic import customer_logic
|
||||
from cms_rest.tests import FunctionalTest
|
||||
from cms_rest.logic.error_base import ErrorStatus
|
||||
import cms_rest.model.Models as models
|
||||
from cms_rest.tests import FunctionalTest
|
||||
|
||||
import mock
|
||||
|
||||
customer = None
|
||||
|
@ -1,14 +1,12 @@
|
||||
import mock
|
||||
import requests
|
||||
import sqlalchemy
|
||||
from wsme.exc import ClientSideError
|
||||
|
||||
from cms_rest.controllers.v1.orm.customer import root
|
||||
from cms_rest.logic.error_base import ErrorStatus
|
||||
|
||||
from cms_rest.model import Models
|
||||
from cms_rest.tests import FunctionalTest
|
||||
from cms_rest.tests import test_utils
|
||||
from cms_rest.tests import FunctionalTest, test_utils
|
||||
import mock
|
||||
import sqlalchemy
|
||||
from wsme.exc import ClientSideError
|
||||
|
||||
customer_logic_mock = None
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import mock
|
||||
import requests
|
||||
|
||||
from cms_rest.controllers.v1.orm.customer import enabled
|
||||
from cms_rest.logic.error_base import ErrorStatus
|
||||
from cms_rest.model import Models
|
||||
from cms_rest.tests import FunctionalTest
|
||||
import mock
|
||||
|
||||
customer_logic_mock = None
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import mock
|
||||
import requests
|
||||
|
||||
from cms_rest.controllers.v1.orm.customer import metadata
|
||||
from cms_rest.logic.error_base import ErrorStatus
|
||||
from cms_rest.model import Models
|
||||
from cms_rest.tests import FunctionalTest
|
||||
import mock
|
||||
|
||||
metadata_logic_mock = None
|
||||
|
||||
|
@ -1,12 +1,11 @@
|
||||
import mock
|
||||
import requests
|
||||
|
||||
from wsme.exc import ClientSideError
|
||||
|
||||
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
|
||||
from wsme.exc import ClientSideError
|
||||
|
||||
customer_logic_mock = None
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
import mock
|
||||
import requests
|
||||
from wsme.exc import ClientSideError
|
||||
|
||||
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
|
||||
from wsme.exc import ClientSideError
|
||||
|
||||
customer_logic_mock = None
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
import mock
|
||||
from cms_rest.tests import FunctionalTest
|
||||
from pecan import conf
|
||||
|
||||
from cms_rest.utils import authentication
|
||||
import mock
|
||||
from pecan import conf
|
||||
|
||||
|
||||
class TestUtil(FunctionalTest):
|
||||
|
@ -1,7 +1,6 @@
|
||||
import mock
|
||||
from cms_rest.tests import FunctionalTest
|
||||
|
||||
from cms_rest.model import Models as models
|
||||
from cms_rest.tests import FunctionalTest
|
||||
import mock
|
||||
|
||||
GROUP_REGIONS = [
|
||||
"DPK",
|
||||
@ -31,8 +30,7 @@ class TestModels(FunctionalTest):
|
||||
|
||||
|
||||
def get_cust_model():
|
||||
"""
|
||||
this function create a customer model object for testing
|
||||
"""this function create a customer model object for testing
|
||||
:return: new customer object
|
||||
"""
|
||||
|
||||
|
@ -1,12 +1,9 @@
|
||||
import mock
|
||||
from mock import MagicMock
|
||||
from cms_rest.tests import FunctionalTest
|
||||
from cms_rest.logger import get_logger
|
||||
from testfixtures import log_capture, compare, Comparison as C
|
||||
import logging
|
||||
from cms_rest import rds_proxy
|
||||
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
|
||||
from testfixtures import log_capture
|
||||
|
||||
|
||||
class Response:
|
||||
|
@ -1,4 +1,5 @@
|
||||
import json
|
||||
|
||||
from wsme.exc import ClientSideError
|
||||
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
import logging
|
||||
|
||||
from keystone_utils import tokens
|
||||
from orm_common.policy import policy
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
from pecan import conf
|
||||
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import os
|
||||
from orm_common.hooks.transaction_id_hook import TransactionIdHook
|
||||
from orm_common.hooks.security_headers_hook import SecurityHeadersHook
|
||||
from orm_common.hooks.api_error_hook import APIErrorHook
|
||||
from orm_common.hooks.security_headers_hook import SecurityHeadersHook
|
||||
from orm_common.hooks.transaction_id_hook import TransactionIdHook
|
||||
|
||||
global TransactionIdHook
|
||||
global APIErrorHook
|
||||
|
@ -1,3 +1,4 @@
|
||||
from pecan.commands import CommandRunner
|
||||
|
||||
runner = CommandRunner()
|
||||
runner.run(['serve', 'config.py'])
|
||||
|
@ -2,5 +2,6 @@
|
||||
' this script is running the pecan web server inside ide so we can set break points in the code and debug our code
|
||||
'''
|
||||
from pecan.commands import CommandRunner
|
||||
|
||||
runner = CommandRunner()
|
||||
runner.run(['serve', 'config.py'])
|
||||
|
@ -1,5 +1,5 @@
|
||||
from orm_common.hooks.api_error_hook import APIErrorHook
|
||||
from fms_rest.hooks.service_hooks import TransIdHook
|
||||
from orm_common.hooks.api_error_hook import APIErrorHook
|
||||
from orm_common.hooks.security_headers_hook import SecurityHeadersHook
|
||||
|
||||
global TransIdHook
|
||||
|
@ -1,4 +1,3 @@
|
||||
from mock import MagicMock
|
||||
from fms_rest.logger import get_logger
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
@ -1,9 +1,10 @@
|
||||
import copy
|
||||
import uuid
|
||||
from mock import MagicMock
|
||||
from fms_rest.data.sql_alchemy.data_manager import DataManager
|
||||
|
||||
from fms_rest.data.sql_alchemy.data_manager import DataManager
|
||||
from fms_rest.logger import get_logger
|
||||
from mock import MagicMock
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
from pecan import make_app
|
||||
import os
|
||||
|
||||
from fms_rest.data import wsme
|
||||
from fms_rest.logger import get_logger
|
||||
from pecan.commands import CommandRunner
|
||||
from fms_rest.utils import authentication
|
||||
from orm_common.policy import policy
|
||||
from pecan.commands import CommandRunner
|
||||
from pecan import make_app
|
||||
|
||||
import os
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
@ -29,4 +30,4 @@ def main():
|
||||
drive, path_and_file = os.path.splitdrive(dir_name)
|
||||
path, filename = os.path.split(path_and_file)
|
||||
runner = CommandRunner()
|
||||
runner.run(['serve', path+'/config.py'])
|
||||
runner.run(['serve', path + '/config.py'])
|
||||
|
@ -1,7 +1,8 @@
|
||||
import os
|
||||
|
||||
import fms_rest.di_providers as di_providers
|
||||
from fms_rest.logger import get_logger
|
||||
from orm_common.injector import injector
|
||||
import fms_rest.di_providers as di_providers
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
@ -1,28 +1,14 @@
|
||||
from pecan import conf, expose
|
||||
from pecan import request
|
||||
|
||||
from webob.exc import status_map
|
||||
from pecan.secure import SecureController
|
||||
from fms_rest.controllers.v1.v1 import V1Controller
|
||||
from fms_rest.utils import authentication
|
||||
from pecan import conf, expose
|
||||
from webob.exc import status_map
|
||||
|
||||
|
||||
class RootController(object):
|
||||
v1 = V1Controller()
|
||||
|
||||
'''
|
||||
@classmethod
|
||||
def check_permissions(cls):
|
||||
# Extract the required values from the request header
|
||||
headers = request.headers
|
||||
token_to_validate = headers.get('X-Auth-Token')
|
||||
lcp_id = headers.get('X-Auth-Region')
|
||||
return authentication.check_permissions(conf, token_to_validate, lcp_id)
|
||||
'''
|
||||
@expose(template='json')
|
||||
def get(self):
|
||||
"""
|
||||
Method to handle GET /
|
||||
"""Method to handle GET /
|
||||
prameters: None
|
||||
return: dict describing flavor command version information
|
||||
"""
|
||||
|
@ -1,11 +1,10 @@
|
||||
"""Configuration rest API input module."""
|
||||
|
||||
import logging
|
||||
from orm_common.utils import utils
|
||||
from pecan import conf
|
||||
from pecan import rest
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
from orm_common.utils import utils
|
||||
from pecan import conf, rest
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -1,20 +1,16 @@
|
||||
from pecan import rest, request, response, expose
|
||||
from pecan.core import abort
|
||||
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
from fms_rest.controllers.v1.orm.flavors.os_extra_specs import \
|
||||
OsExtraSpecsController
|
||||
from fms_rest.controllers.v1.orm.flavors.regions import RegionController
|
||||
from fms_rest.controllers.v1.orm.flavors.tenants import TenantController
|
||||
from fms_rest.controllers.v1.orm.flavors.os_extra_specs import OsExtraSpecsController
|
||||
from fms_rest.controllers.v1.orm.flavors.tags import TagsController
|
||||
|
||||
from fms_rest.data.wsme.models import FlavorWrapper, FlavorListFullResponse
|
||||
from fms_rest.logic.error_base import ErrorStatus
|
||||
from fms_rest.controllers.v1.orm.flavors.tenants import TenantController
|
||||
from fms_rest.data.wsme.models import FlavorListFullResponse, FlavorWrapper
|
||||
from fms_rest.logger import get_logger
|
||||
from fms_rest.logic.error_base import ErrorStatus
|
||||
from fms_rest.utils import authentication
|
||||
|
||||
from orm_common.injector import injector
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
from pecan import request, rest
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
di = injector.get_di()
|
||||
LOG = get_logger(__name__)
|
||||
|
@ -1,16 +1,11 @@
|
||||
import base
|
||||
from pecan import rest, request, response
|
||||
from wsmeext.pecan import wsexpose
|
||||
from fms_rest.data.wsme.models import ExtraSpecsWrapper
|
||||
|
||||
from orm_common.injector import injector
|
||||
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
|
||||
from fms_rest.logic.error_base import ErrorStatus
|
||||
|
||||
from fms_rest.logger import get_logger
|
||||
from fms_rest.logic.error_base import ErrorStatus
|
||||
from fms_rest.utils import authentication
|
||||
from orm_common.injector import injector
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
from pecan import request, rest
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
LOG = get_logger(__name__)
|
||||
|
||||
|
@ -1,14 +1,11 @@
|
||||
from pecan import rest, request
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
from fms_rest.data.wsme.models import RegionWrapper
|
||||
from fms_rest.logic.error_base import ErrorStatus
|
||||
from base import ClientSideError
|
||||
from fms_rest.logger import get_logger
|
||||
|
||||
from fms_rest.logic.error_base import ErrorStatus
|
||||
from fms_rest.utils import authentication
|
||||
from orm_common.injector import injector
|
||||
from orm_common.utils import api_error_utils as err_utils
|
||||
from fms_rest.utils import authentication
|
||||
from pecan import request, rest
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
LOG = get_logger(__name__)
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user