
* Incremented version to 0.2.2 for pypi release. * Removed all post-install hooks. All initialization and configuration should be done through the cafe-config cli tool. * Added setup.cfg with support for universal bdist wheel. * Updated MANIFEST.in file. * Updated README.rst to reflect new install procedures. * Modified cafe-config so that initialization command is now just "cafe-config init". * Since the ".opencafe" directory is no longer initialized at install while access to the source code is guaranteed, the plugins are now distributed as package_data, and installed as such to site-packages under the new "plugins" directory within the "cafe" namespace. * The plugins directory is moved to the cafe package directory as package_data. * The plugin cache is no longer created at initialization, and all code relating to it in the cli.py and managers.py file has been removed. * Removed pip-requires file in favor of including the only requirement, 'six', in setup.py. The plan is to refactor so as to remove the dependency on six eventually. * Renamed test-requirements.txt to test-requires. * Added Authors.rst Change-Id: I28a605f926ae5f2d972a6a36171d0e4eb92cac09
50 lines
1.5 KiB
Python
50 lines
1.5 KiB
Python
# Copyright 2015 Rackspace
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from unittest import TestCase
|
|
|
|
from cafe.resources.rsyslog.client import RSyslogClient, MessageHandler
|
|
|
|
|
|
class TestSyslogClient(TestCase):
|
|
DEFAULT_SD_DICT = {
|
|
'test_project': {
|
|
'token': 'test-token',
|
|
'tenant': 'test-tenant'
|
|
}
|
|
}
|
|
|
|
SAMPLE_SD_DICT = {
|
|
'origin': {
|
|
'software': 'opencafe-rsyslog'
|
|
}
|
|
}
|
|
|
|
def setUp(self):
|
|
self.client = RSyslogClient(default_sd=self.DEFAULT_SD_DICT)
|
|
self.client.connect()
|
|
|
|
def tearDown(self):
|
|
self.client.close()
|
|
|
|
def test_conversion_between_sd_dict_to_syslog_str(self):
|
|
result = MessageHandler.sd_dict_to_syslog_str(self.SAMPLE_SD_DICT)
|
|
self.assertEqual(result, '[origin software="opencafe-rsyslog"]')
|
|
|
|
def test_send_basic_message(self):
|
|
result = self.client.send(priority=1, msg='bam',
|
|
sd=self.SAMPLE_SD_DICT)
|
|
|
|
# A socket should return None if it was successful.
|
|
self.assertIsNone(result)
|