1 # Copyright 2019 AT&T Intellectual Property. All rights reserved.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
16 from unittest import TestCase
18 from ONAPLibrary.ProtobufKeywords import ProtobufKeywords
21 class ProtobufKeywordsTest(TestCase):
25 path = os.path.realpath(
26 os.path.join(os.getcwd(), os.path.dirname(__file__)))
30 with open(os.path.join(self._get_location(), "hvves_msg.raw"), "rb") as fileToDo:
31 value = fileToDo.read()
32 pb = ProtobufKeywords()
33 result = pb.compare_file_to_message(os.path.join(self._get_location(), "hvves_msg.raw"), value)
34 self.assertTrue(result)
36 def test_compare_two(self):
37 with open(os.path.join(self._get_location(), "hvves_msg.raw"), "rb") as fileToDo:
38 value = fileToDo.read()
39 pb = ProtobufKeywords()
40 result = pb.compare_two_messages(value, value)
41 self.assertTrue(result)
43 def test_compare_two_many(self):
44 with open(os.path.join(self._get_location(), "hvves_msg.raw"), "rb") as fileToDo:
45 value = fileToDo.read()
46 pb = ProtobufKeywords()
47 result = pb.compare_two_messages(value, value)
48 self.assertTrue(result)
49 result = pb.compare_two_messages(value, value)
50 self.assertTrue(result)