Refactor project tree

Old project tree had everything mixed up
in different locations. Not to mention
that actual REST controllers resided in
package that's name did not reflect the content.

Reorganized the tree to be more predictable
and easier to maintain.

Change-Id: Ic9acc80a4cf7416394702d43141c96953c03beea
This commit is contained in:
Tomasz Trębski 2017-07-20 07:00:32 +02:00
parent 65ff274f9f
commit f55f34c9c4
38 changed files with 111 additions and 121 deletions

View File

@ -13,7 +13,7 @@ handlers = console, file
[logger_kafka]
qualname = kafka
level = DEBUG
level = INFO
handlers = console, file
propagate = 0

View File

@ -22,13 +22,13 @@ import six
import falcon
from oslo_log import log
from monasca_log_api.api.core import request
from monasca_log_api.app.base import error_handlers
from monasca_log_api.app.base import request
from monasca_log_api.app.controller import healthchecks
from monasca_log_api.app.controller.v2 import logs as v2_logs
from monasca_log_api.app.controller.v3 import logs as v3_logs
from monasca_log_api.app.controller import versions
from monasca_log_api import config
from monasca_log_api.reference.common import error_handlers
from monasca_log_api.reference import healthchecks
from monasca_log_api.reference.v2 import logs as v2_logs
from monasca_log_api.reference.v3 import logs as v3_logs
from monasca_log_api.reference import versions
def error_trap(app_name):

View File

@ -14,7 +14,7 @@
import falcon
from monasca_log_api.reference.common import model
from monasca_log_api.app.base import model
def log_envelope_exception_handler(ex, req, resp, params):

View File

@ -20,10 +20,10 @@ from monasca_common.kafka import producer
from monasca_common.rest import utils as rest_utils
from oslo_log import log
from monasca_log_api.app.base import model
from monasca_log_api import conf
from monasca_log_api.monitoring import client
from monasca_log_api.monitoring import metrics
from monasca_log_api.reference.common import model
LOG = log.getLogger(__name__)
CONF = conf.CONF

View File

@ -16,7 +16,7 @@ import falcon
from oslo_context import context
from monasca_log_api.reference.common import validation
from monasca_log_api.app.base import validation
_TENANT_ID_PARAM = 'tenant_id'
"""Name of the query-param pointing at project-id (tenant-id)"""

View File

@ -18,7 +18,7 @@ import falcon
from oslo_log import log
import six
from monasca_log_api.api import exceptions
from monasca_log_api.app.base import exceptions
from monasca_log_api import conf
LOG = log.getLogger(__name__)

View File

@ -13,10 +13,9 @@
# under the License.
import falcon
from monasca_common.rest import utils as rest_utils
from monasca_log_api.api import healthcheck_api
from monasca_log_api.app.controller.api import healthcheck_api
from monasca_log_api.healthcheck import kafka_check

View File

@ -19,10 +19,10 @@ from monasca_common.rest import utils as rest_utils
from oslo_config import cfg
from oslo_log import log
from monasca_log_api.api import exceptions
from monasca_log_api.app.base import exceptions
from monasca_log_api.app.base import model
from monasca_log_api.app.base import validation
from monasca_log_api import conf
from monasca_log_api.reference.common import model
from monasca_log_api.reference.common import validation
LOG = log.getLogger(__name__)
CONF = conf.CONF

View File

@ -16,10 +16,10 @@
import falcon
import six
from monasca_log_api.api import headers
from monasca_log_api.api import logs_api
from monasca_log_api.reference.common import log_publisher
from monasca_log_api.reference.v2.common import service
from monasca_log_api.app.base import log_publisher
from monasca_log_api.app.controller.api import headers
from monasca_log_api.app.controller.api import logs_api
from monasca_log_api.app.controller.v2.aid import service
_DEPRECATED_INFO = ('/v2.0/log/single has been deprecated. '
'Please use /v3.0/logs')

View File

@ -14,10 +14,10 @@
from oslo_log import log
from monasca_log_api.app.base import log_publisher
from monasca_log_api.app.base import model
from monasca_log_api.app.base import validation
from monasca_log_api import conf
from monasca_log_api.reference.common import log_publisher
from monasca_log_api.reference.common import model
from monasca_log_api.reference.common import validation
LOG = log.getLogger(__name__)
CONF = conf.CONF
@ -27,7 +27,7 @@ class BulkProcessor(log_publisher.LogPublisher):
"""BulkProcessor for effective log processing and publishing.
BulkProcessor is customized version of
:py:class:`monasca_log_api.reference.common.log_publisher.LogPublisher`
:py:class:`monasca_log_api.app.base.log_publisher.LogPublisher`
that utilizes processing of bulk request inside single loop.
"""

View File

@ -19,8 +19,8 @@ import falcon
from monasca_common.rest import utils as rest_utils
from oslo_log import log
from monasca_log_api.api import exceptions
from monasca_log_api.reference.common import validation
from monasca_log_api.app.base import exceptions
from monasca_log_api.app.base import validation
LOG = log.getLogger(__name__)

View File

@ -16,12 +16,12 @@
import falcon
from oslo_log import log
from monasca_log_api.api import exceptions
from monasca_log_api.api import logs_api
from monasca_log_api.app.base import exceptions
from monasca_log_api.app.base import validation
from monasca_log_api.app.controller.api import logs_api
from monasca_log_api.app.controller.v3.aid import bulk_processor
from monasca_log_api.app.controller.v3.aid import helpers
from monasca_log_api.monitoring import metrics
from monasca_log_api.reference.common import validation
from monasca_log_api.reference.v3.common import bulk_processor
from monasca_log_api.reference.v3.common import helpers
LOG = log.getLogger(__name__)

View File

@ -18,7 +18,7 @@ import six
from monasca_common.rest import utils as rest_utils
from monasca_log_api.api import versions_api
from monasca_log_api.app.controller.api import versions_api
_VERSIONS_TPL_DICT = {
'v2.0': {

View File

@ -33,33 +33,19 @@ def load_conf_modules():
- register_opts (required by :py:currentmodule:)
"""
imported_modules = []
for modname in _list_module_names():
mod = importutils.import_module('monasca_log_api.conf.' + modname)
required_funcs = ['register_opts', 'list_opts']
for func in required_funcs:
if not hasattr(mod, func):
msg = ("The module 'monasca_log_api.conf.%s' should have a"
" '%s' function which returns"
" the config options."
% (modname, func))
LOG.warning(msg)
else:
imported_modules.append(mod)
LOG.debug('Found %d modules that contain configuration',
len(imported_modules))
return imported_modules
if hasattr(mod, func):
yield mod
def _list_module_names():
module_names = []
package_path = os.path.dirname(os.path.abspath(__file__))
for _, modname, ispkg in pkgutil.iter_modules(path=[package_path]):
if not (modname == "opts" and ispkg):
module_names.append(modname)
return module_names
yield modname
def register_opts():

View File

@ -27,7 +27,7 @@ from oslo_context import fixture as oo_ctx
from oslotest import base as oslotest_base
import six
from monasca_log_api.api.core import request
from monasca_log_api.app.base import request
from monasca_log_api import conf
from monasca_log_api import config

View File

@ -16,8 +16,8 @@ import falcon
import mock
import simplejson as json
from monasca_log_api.app.controller import healthchecks
from monasca_log_api.healthcheck import kafka_check as healthcheck
from monasca_log_api.reference import healthchecks
from monasca_log_api.tests import base
ENDPOINT = '/healthcheck'

View File

@ -24,8 +24,8 @@ from oslo_config import cfg
from oslo_log import log
import six
from monasca_log_api.reference.common import log_publisher
from monasca_log_api.reference.common import model
from monasca_log_api.app.base import log_publisher
from monasca_log_api.app.base import model
from monasca_log_api.tests import base
LOG = log.getLogger(__name__)
@ -34,7 +34,7 @@ EPOCH_START = datetime.datetime(1970, 1, 1)
class TestSendMessage(base.BaseTestCase):
@mock.patch('monasca_log_api.reference.common.log_publisher.producer'
@mock.patch('monasca_log_api.app.base.log_publisher.producer'
'.KafkaProducer')
def test_should_not_send_empty_message(self, _):
instance = log_publisher.LogPublisher()
@ -50,7 +50,7 @@ class TestSendMessage(base.BaseTestCase):
not_dict_value = 123
instance.send_message(not_dict_value)
@mock.patch('monasca_log_api.reference.common.log_publisher.producer'
@mock.patch('monasca_log_api.app.base.log_publisher.producer'
'.KafkaProducer')
def test_should_not_send_message_missing_keys(self, _):
# checks every combination of missing keys
@ -74,7 +74,7 @@ class TestSendMessage(base.BaseTestCase):
instance.send_message,
message)
@mock.patch('monasca_log_api.reference.common.log_publisher.producer'
@mock.patch('monasca_log_api.app.base.log_publisher.producer'
'.KafkaProducer')
def test_should_not_send_message_missing_values(self, _):
# original message assumes that every property has value
@ -98,7 +98,7 @@ class TestSendMessage(base.BaseTestCase):
instance.send_message,
tmp_message)
@mock.patch('monasca_log_api.reference.common.log_publisher.producer'
@mock.patch('monasca_log_api.app.base.log_publisher.producer'
'.KafkaProducer')
def test_should_send_message(self, kafka_producer):
instance = log_publisher.LogPublisher()
@ -133,7 +133,7 @@ class TestSendMessage(base.BaseTestCase):
cfg.CONF.log_publisher.topics[0],
[ujson.dumps(msg, ensure_ascii=False).encode('utf-8')])
@mock.patch('monasca_log_api.reference.common.log_publisher.producer'
@mock.patch('monasca_log_api.app.base.log_publisher.producer'
'.KafkaProducer')
def test_should_send_message_multiple_topics(self, _):
topics = ['logs', 'analyzer', 'tester']
@ -177,7 +177,7 @@ class TestSendMessage(base.BaseTestCase):
topic,
[json_msg.encode('utf-8')])
@mock.patch('monasca_log_api.reference.common.log_publisher.producer'
@mock.patch('monasca_log_api.app.base.log_publisher.producer'
'.KafkaProducer')
def test_should_send_unicode_message(self, kp):
instance = log_publisher.LogPublisher()
@ -216,7 +216,7 @@ class TestSendMessage(base.BaseTestCase):
@mock.patch(
'monasca_log_api.reference.common.log_publisher.producer'
'monasca_log_api.app.base.log_publisher.producer'
'.KafkaProducer')
class TestTruncation(base.BaseTestCase):
EXTRA_CHARS_SIZE = len(bytearray(ujson.dumps({

View File

@ -16,9 +16,9 @@
import falcon
import mock
from monasca_log_api.api import exceptions as log_api_exceptions
from monasca_log_api.api import headers
from monasca_log_api.reference.v2 import logs
from monasca_log_api.app.base import exceptions as log_api_exceptions
from monasca_log_api.app.controller.api import headers
from monasca_log_api.app.controller.v2 import logs
from monasca_log_api.tests import base
ROLES = 'admin'
@ -31,8 +31,8 @@ def _init_resource(test):
class TestApiLogsVersion(base.BaseApiTestCase):
@mock.patch('monasca_log_api.reference.common.log_publisher.LogPublisher')
@mock.patch('monasca_log_api.reference.v2.common.service.LogCreator')
@mock.patch('monasca_log_api.app.base.log_publisher.LogPublisher')
@mock.patch('monasca_log_api.app.controller.v2.aid.service.LogCreator')
def test_should_return_v2_as_version(self, _, __):
logs_resource = logs.Logs()
self.assertEqual('v2.0', logs_resource.version)
@ -40,8 +40,8 @@ class TestApiLogsVersion(base.BaseApiTestCase):
class TestApiLogs(base.BaseApiTestCase):
@mock.patch('monasca_log_api.reference.common.log_publisher.LogPublisher')
@mock.patch('monasca_log_api.reference.v2.common.service.LogCreator')
@mock.patch('monasca_log_api.app.base.log_publisher.LogPublisher')
@mock.patch('monasca_log_api.app.controller.v2.aid.service.LogCreator')
def test_should_contain_deprecated_details_in_successful_response(self,
_,
__):
@ -62,8 +62,8 @@ class TestApiLogs(base.BaseApiTestCase):
self.assertIn('deprecated', self.srmock.headers_dict)
self.assertIn('link', self.srmock.headers_dict)
@mock.patch('monasca_log_api.reference.common.log_publisher.LogPublisher')
@mock.patch('monasca_log_api.reference.v2.common.service.LogCreator')
@mock.patch('monasca_log_api.app.base.log_publisher.LogPublisher')
@mock.patch('monasca_log_api.app.controller.v2.aid.service.LogCreator')
def test_should_fail_not_delegate_ok_cross_tenant_id(self, _, __):
_init_resource(self)
self.simulate_request(
@ -77,8 +77,8 @@ class TestApiLogs(base.BaseApiTestCase):
)
self.assertEqual(falcon.HTTP_403, self.srmock.status)
@mock.patch('monasca_log_api.reference.v2.common.service.LogCreator')
@mock.patch('monasca_log_api.reference.common.log_publisher.LogPublisher')
@mock.patch('monasca_log_api.app.controller.v2.aid.service.LogCreator')
@mock.patch('monasca_log_api.app.base.log_publisher.LogPublisher')
def test_should_pass_empty_cross_tenant_id_wrong_role(self,
log_creator,
kafka_publisher):
@ -102,8 +102,8 @@ class TestApiLogs(base.BaseApiTestCase):
self.assertEqual(1, log_creator.new_log.call_count)
self.assertEqual(1, log_creator.new_log_envelope.call_count)
@mock.patch('monasca_log_api.reference.v2.common.service.LogCreator')
@mock.patch('monasca_log_api.reference.common.log_publisher.LogPublisher')
@mock.patch('monasca_log_api.app.controller.v2.aid.service.LogCreator')
@mock.patch('monasca_log_api.app.base.log_publisher.LogPublisher')
def test_should_pass_empty_cross_tenant_id_ok_role(self,
log_creator,
kafka_publisher):
@ -127,8 +127,8 @@ class TestApiLogs(base.BaseApiTestCase):
self.assertEqual(1, log_creator.new_log.call_count)
self.assertEqual(1, log_creator.new_log_envelope.call_count)
@mock.patch('monasca_log_api.reference.v2.common.service.LogCreator')
@mock.patch('monasca_log_api.reference.common.log_publisher.LogPublisher')
@mock.patch('monasca_log_api.app.controller.v2.aid.service.LogCreator')
@mock.patch('monasca_log_api.app.base.log_publisher.LogPublisher')
def test_should_pass_delegate_cross_tenant_id_ok_role(self,
log_creator,
log_publisher):
@ -154,7 +154,7 @@ class TestApiLogs(base.BaseApiTestCase):
self.assertEqual(1, log_creator.new_log_envelope.call_count)
@mock.patch('monasca_common.rest.utils')
@mock.patch('monasca_log_api.reference.common.log_publisher.LogPublisher')
@mock.patch('monasca_log_api.app.base.log_publisher.LogPublisher')
def test_should_fail_empty_dimensions_delegate(self, _, rest_utils):
_init_resource(self)
rest_utils.read_body.return_value = True
@ -172,8 +172,8 @@ class TestApiLogs(base.BaseApiTestCase):
)
self.assertEqual(log_api_exceptions.HTTP_422, self.srmock.status)
@mock.patch('monasca_log_api.reference.v2.common.service.LogCreator')
@mock.patch('monasca_log_api.reference.common.log_publisher.LogPublisher')
@mock.patch('monasca_log_api.app.controller.v2.aid.service.LogCreator')
@mock.patch('monasca_log_api.app.base.log_publisher.LogPublisher')
def test_should_fail_for_invalid_content_type(self, _, __):
_init_resource(self)
@ -189,8 +189,8 @@ class TestApiLogs(base.BaseApiTestCase):
)
self.assertEqual(falcon.HTTP_415, self.srmock.status)
@mock.patch('monasca_log_api.reference.v2.common.service.LogCreator')
@mock.patch('monasca_log_api.reference.common.log_publisher.LogPublisher')
@mock.patch('monasca_log_api.app.controller.v2.aid.service.LogCreator')
@mock.patch('monasca_log_api.app.base.log_publisher.LogPublisher')
def test_should_pass_payload_size_not_exceeded(self, _, __):
_init_resource(self)
@ -210,8 +210,8 @@ class TestApiLogs(base.BaseApiTestCase):
)
self.assertEqual(falcon.HTTP_204, self.srmock.status)
@mock.patch('monasca_log_api.reference.v2.common.service.LogCreator')
@mock.patch('monasca_log_api.reference.common.log_publisher.LogPublisher')
@mock.patch('monasca_log_api.app.controller.v2.aid.service.LogCreator')
@mock.patch('monasca_log_api.app.base.log_publisher.LogPublisher')
def test_should_fail_payload_size_exceeded(self, _, __):
_init_resource(self)
@ -231,8 +231,8 @@ class TestApiLogs(base.BaseApiTestCase):
)
self.assertEqual(falcon.HTTP_413, self.srmock.status)
@mock.patch('monasca_log_api.reference.v2.common.service.LogCreator')
@mock.patch('monasca_log_api.reference.common.log_publisher.LogPublisher')
@mock.patch('monasca_log_api.app.controller.v2.aid.service.LogCreator')
@mock.patch('monasca_log_api.app.base.log_publisher.LogPublisher')
def test_should_fail_payload_size_equal(self, _, __):
_init_resource(self)
@ -252,8 +252,8 @@ class TestApiLogs(base.BaseApiTestCase):
)
self.assertEqual(falcon.HTTP_413, self.srmock.status)
@mock.patch('monasca_log_api.reference.v2.common.service.LogCreator')
@mock.patch('monasca_log_api.reference.common.log_publisher.LogPublisher')
@mock.patch('monasca_log_api.app.controller.v2.aid.service.LogCreator')
@mock.patch('monasca_log_api.app.base.log_publisher.LogPublisher')
def test_should_fail_content_length(self, _, __):
_init_resource(self)

View File

@ -16,9 +16,9 @@ import falcon
import mock
import ujson as json
from monasca_log_api.api import exceptions as log_api_exceptions
from monasca_log_api.api import headers
from monasca_log_api.reference.v3 import logs
from monasca_log_api.app.base import exceptions as log_api_exceptions
from monasca_log_api.app.controller.api import headers
from monasca_log_api.app.controller.v3 import logs
from monasca_log_api.tests import base
ENDPOINT = '/logs'
@ -64,15 +64,14 @@ def _generate_v3_payload(log_count=None, messages=None):
class TestApiLogsVersion(base.BaseApiTestCase):
@mock.patch('monasca_log_api.reference.v3.common.'
'bulk_processor.BulkProcessor')
@mock.patch('monasca_log_api.app.controller.v3.aid'
'.bulk_processor.BulkProcessor')
def test_should_return_v3_as_version(self, _):
logs_resource = logs.Logs()
self.assertEqual('v3.0', logs_resource.version)
@mock.patch('monasca_log_api.reference.common.log_publisher.producer.'
'KafkaProducer')
@mock.patch('monasca_log_api.app.base.log_publisher.producer.KafkaProducer')
@mock.patch('monasca_log_api.monitoring.client.monascastatsd.Connection')
class TestApiLogsMonitoring(base.BaseApiTestCase):
@ -203,7 +202,7 @@ class TestApiLogsMonitoring(base.BaseApiTestCase):
class TestApiLogs(base.BaseApiTestCase):
@mock.patch('monasca_log_api.reference.v3.common.bulk_processor.'
@mock.patch('monasca_log_api.app.controller.v3.aid.bulk_processor.'
'BulkProcessor')
def test_should_pass_cross_tenant_id(self, bulk_processor):
logs_resource = _init_resource(self)
@ -229,7 +228,7 @@ class TestApiLogs(base.BaseApiTestCase):
global_dimensions=v3_body['dimensions'],
log_tenant_id='1')
@mock.patch('monasca_log_api.reference.v3.common.bulk_processor.'
@mock.patch('monasca_log_api.app.controller.v3.aid.bulk_processor.'
'BulkProcessor')
def test_should_fail_not_delegate_ok_cross_tenant_id(self, _):
_init_resource(self)
@ -244,7 +243,7 @@ class TestApiLogs(base.BaseApiTestCase):
)
self.assertEqual(falcon.HTTP_403, self.srmock.status)
@mock.patch('monasca_log_api.reference.v3.common.bulk_processor.'
@mock.patch('monasca_log_api.app.controller.v3.aid.bulk_processor.'
'BulkProcessor')
def test_should_pass_empty_cross_tenant_id_wrong_role(self,
bulk_processor):
@ -267,7 +266,7 @@ class TestApiLogs(base.BaseApiTestCase):
self.assertEqual(falcon.HTTP_204, self.srmock.status)
self.assertEqual(1, bulk_processor.send_message.call_count)
@mock.patch('monasca_log_api.reference.v3.common.bulk_processor.'
@mock.patch('monasca_log_api.app.controller.v3.aid.bulk_processor.'
'BulkProcessor')
def test_should_pass_empty_cross_tenant_id_ok_role(self,
bulk_processor):
@ -293,7 +292,7 @@ class TestApiLogs(base.BaseApiTestCase):
class TestUnicodeLogs(base.BaseApiTestCase):
@mock.patch('monasca_log_api.reference.common.log_publisher.producer.'
@mock.patch('monasca_log_api.app.base.log_publisher.producer.'
'KafkaProducer')
def test_should_send_unicode_messages(self, _):
_init_resource(self)

View File

@ -15,8 +15,8 @@
from falcon import testing
from mock import mock
from monasca_log_api.api.core import request
from monasca_log_api.reference.common import validation
from monasca_log_api.app.base import request
from monasca_log_api.app.base import validation
from monasca_log_api.tests import base

View File

@ -20,9 +20,9 @@ from falcon import errors
from falcon import testing
import mock
from monasca_log_api.api import exceptions
from monasca_log_api.reference.common import validation
from monasca_log_api.reference.v2.common import service as common_service
from monasca_log_api.app.base import exceptions
from monasca_log_api.app.base import validation
from monasca_log_api.app.controller.v2.aid import service as aid_service
from monasca_log_api.tests import base
@ -47,22 +47,22 @@ class IsDelegate(base.BaseTestCase):
class ParseDimensions(base.BaseTestCase):
def test_should_fail_for_empty_dimensions(self):
self.assertRaises(exceptions.HTTPUnprocessableEntity,
common_service.parse_dimensions,
aid_service.parse_dimensions,
'')
self.assertRaises(exceptions.HTTPUnprocessableEntity,
common_service.parse_dimensions,
aid_service.parse_dimensions,
None)
def test_should_fail_for_empty_dim_in_dimensions(self):
err = self.assertRaises(exceptions.HTTPUnprocessableEntity,
common_service.parse_dimensions,
aid_service.parse_dimensions,
',')
self.assertEqual(err.description, 'Dimension cannot be empty')
def test_should_fail_for_invalid_dim_in_dimensions(self):
invalid_dim = 'a'
err = self.assertRaises(exceptions.HTTPUnprocessableEntity,
common_service.parse_dimensions,
aid_service.parse_dimensions,
invalid_dim)
self.assertEqual(err.description, '%s is not a valid dimension'
% invalid_dim)
@ -75,29 +75,29 @@ class ParseDimensions(base.BaseTestCase):
}
self.assertDictEqual(expected,
common_service.parse_dimensions(dimensions))
aid_service.parse_dimensions(dimensions))
class ParseApplicationType(base.BaseTestCase):
def test_should_return_none_for_none(self):
self.assertIsNone(common_service.parse_application_type(None))
self.assertIsNone(aid_service.parse_application_type(None))
def test_should_return_none_for_empty(self):
self.assertIsNone(common_service.parse_application_type(''))
self.assertIsNone(aid_service.parse_application_type(''))
def test_should_return_none_for_whitespace_filled(self):
self.assertIsNone(common_service.parse_application_type(' '))
self.assertIsNone(aid_service.parse_application_type(' '))
def test_should_return_value_for_ok_value(self):
app_type = 'monasca'
self.assertEqual(app_type,
common_service.parse_application_type(app_type))
aid_service.parse_application_type(app_type))
def test_should_return_value_for_ok_value_with_spaces(self):
app_type = ' monasca '
expected = 'monasca'
self.assertEqual(expected,
common_service.parse_application_type(app_type))
aid_service.parse_application_type(app_type))
class ApplicationTypeValidations(base.BaseTestCase):
@ -355,7 +355,7 @@ class LogMessageValidations(base.BaseTestCase):
class LogsCreatorNewLog(base.BaseTestCase):
def setUp(self):
super(LogsCreatorNewLog, self).setUp()
self.instance = common_service.LogCreator()
self.instance = aid_service.LogCreator()
@mock.patch('io.IOBase')
def test_should_create_log_from_json(self, payload):
@ -409,7 +409,7 @@ class LogsCreatorNewLog(base.BaseTestCase):
class LogCreatorNewEnvelope(base.BaseTestCase):
def setUp(self):
super(LogCreatorNewEnvelope, self).setUp()
self.instance = common_service.LogCreator()
self.instance = aid_service.LogCreator()
def test_should_create_envelope(self):
msg = u'Hello World'

View File

@ -15,17 +15,17 @@
import mock
import ujson as json
from monasca_log_api.api import headers
from monasca_log_api.reference.v2 import logs as v2_logs
from monasca_log_api.reference.v3 import logs as v3_logs
from monasca_log_api.app.controller.api import headers
from monasca_log_api.app.controller.v2 import logs as v2_logs
from monasca_log_api.app.controller.v3 import logs as v3_logs
from monasca_log_api.tests import base
class TestApiSameV2V3Output(base.BaseApiTestCase):
# noinspection PyProtectedMember
@mock.patch('monasca_log_api.reference.common.'
'log_publisher.producer.KafkaProducer')
@mock.patch('monasca_log_api.app.base.log_publisher.'
'producer.KafkaProducer')
def test_send_identical_messages(self, _):
# mocks only log publisher, so the last component that actually
# sends data to kafka

View File

@ -15,7 +15,7 @@
import falcon
import ujson as json
from monasca_log_api.reference import versions
from monasca_log_api.app.controller import versions
from monasca_log_api.tests import base

View File

@ -0,0 +1,6 @@
---
other:
- |
Refactored project tree into more predictable and organized
one. Old tree had everythin mixed up between different locations,
and it was very difficult to follow the code.