X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_common%2Ftests%2Ftest_msglocal.py;h=41f6eb8d0d4c6ebcaec4dfff00855837809d50e0;hb=70911f00b815917f2fd0946caa36c1bbc88e890e;hp=f2b63ccccf814f92bc536b978c2879bfc7d3d89f;hpb=1e9a329ca0085be33665e35d123394905bc46d74;p=osm%2Fcommon.git diff --git a/osm_common/tests/test_msglocal.py b/osm_common/tests/test_msglocal.py index f2b63cc..41f6eb8 100644 --- a/osm_common/tests/test_msglocal.py +++ b/osm_common/tests/test_msglocal.py @@ -1,3 +1,22 @@ +# Copyright 2018 Whitestack, LLC +# Copyright 2018 Telefonica S.A. +# +# 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. +# +# For those usages not covered by the Apache License, Version 2.0 please +# contact: esousa@whitestack.com or alfonso.tiernosepulveda@telefonica.com +## + import http import logging import pytest @@ -181,7 +200,7 @@ def test_write(msg_local_config, topic, key, msg): assert os.path.exists(file_path) with open(file_path, 'r') as stream: - assert yaml.load(stream) == {key: msg if not isinstance(msg, tuple) else list(msg)} + assert yaml.safe_load(stream) == {key: msg if not isinstance(msg, tuple) else list(msg)} @pytest.mark.parametrize("topic, key, msg, times", [ @@ -206,7 +225,7 @@ def test_write_with_multiple_calls(msg_local_config, topic, key, msg, times): with open(file_path, 'r') as stream: for _ in range(times): data = stream.readline() - assert yaml.load(data) == {key: msg if not isinstance(msg, tuple) else list(msg)} + assert yaml.safe_load(data) == {key: msg if not isinstance(msg, tuple) else list(msg)} def test_write_exception(msg_local_config): @@ -434,7 +453,7 @@ def test_aiowrite(msg_local_config, event_loop, topic, key, msg): assert os.path.exists(file_path) with open(file_path, 'r') as stream: - assert yaml.load(stream) == {key: msg if not isinstance(msg, tuple) else list(msg)} + assert yaml.safe_load(stream) == {key: msg if not isinstance(msg, tuple) else list(msg)} @pytest.mark.parametrize("topic, key, msg, times", [ @@ -458,7 +477,7 @@ def test_aiowrite_with_multiple_calls(msg_local_config, event_loop, topic, key, with open(file_path, 'r') as stream: for _ in range(times): data = stream.readline() - assert yaml.load(data) == {key: msg if not isinstance(msg, tuple) else list(msg)} + assert yaml.safe_load(data) == {key: msg if not isinstance(msg, tuple) else list(msg)} def test_aiowrite_exception(msg_local_config, event_loop):