########################################################################### # # Copyright (c) 2021-2024 Diality Inc. - All Rights Reserved. # # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # @file test_msg_ids.py # # @author (last) Peter Lucia # @date (last) 06-Apr-2021 # @author (original) Peter Lucia # @date (original) 06-Apr-2021 # ############################################################################ import re import unittest import sys import os sys.path.append("../../") from dialin.common import MsgIds class Test(unittest.TestCase): def test_msg_ids(self): os.chdir("../../") for root, dirs, files in os.walk("dialin/"): for file in files: if file.endswith(".py"): path = os.path.join(root, file) with open(path, 'r') as f: for line in f.readlines(): m = re.search('MSG_ID_.*.value', line) if m is not None: s = m.group(0) s = s.replace(".value", "").strip() self.assertTrue(s in MsgIds.__members__, "{0} in {1} not found in MsgIds." .format(s, path)) if __name__ == '__main__': sys.exit(unittest.main(verbosity=2).result.wasSuccessful())