"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "monasca_api/tests/test_logs.py" between
monasca-api-3.1.0.tar.gz and monasca-api-4.0.0.tar.gz

About: OpenStack Monasca API is a RESTful API server that is designed with a layered architecture and supports Monitoring as a Service (MONaaS).
The "Ussuri" series (latest release).

test_logs.py  (monasca-api-3.1.0):test_logs.py  (monasca-api-4.0.0)
skipping to change at line 16 skipping to change at line 16
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import falcon import falcon
import mock import simplejson as json
import ujson as json from unittest import mock
from monasca_api.tests import base from monasca_api.tests import base
from monasca_api.v2.reference import logs from monasca_api.v2.reference import logs
ENDPOINT = '/logs' ENDPOINT = '/logs'
TENANT_ID = 'bob' TENANT_ID = 'bob'
ROLES = 'admin' ROLES = 'admin'
def _init_resource(test): def _init_resource(test):
resource = logs.Logs() resource = logs.Logs()
skipping to change at line 155 skipping to change at line 155
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Content-Length': str(content_length) 'Content-Length': str(content_length)
}, },
body=payload body=payload
) )
self.assertEqual(falcon.HTTP_204, response.status) self.assertEqual(falcon.HTTP_204, response.status)
self.assertEqual(1, bulk_processor.send_message.call_count) self.assertEqual(1, bulk_processor.send_message.call_count)
class TestUnicodeLogs(base.BaseApiTestCase): class TestUnicodeLogs(base.BaseApiTestCase):
@mock.patch('monasca_api.api.core.log.log_publisher.producer.' @mock.patch('monasca_api.api.core.log.log_publisher.client_factory'
'KafkaProducer') '.get_kafka_producer')
def test_should_send_unicode_messages(self, _): def test_should_send_unicode_messages(self, _):
_init_resource(self) _init_resource(self)
messages = [m['input'] for m in base.UNICODE_MESSAGES] messages = [m['input'] for m in base.UNICODE_MESSAGES]
body, _ = _generate_payload(messages=messages) body, _ = _generate_payload(messages=messages)
payload = json.dumps(body, ensure_ascii=False) payload = json.dumps(body, ensure_ascii=False)
response = self.simulate_request( response = self.simulate_request(
path='/logs', path='/logs',
method='POST', method='POST',
headers={ headers={
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)