1# Copyright 2017 The Chromium OS Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import unittest 6 7import parse 8 9 10class ParseHuddlyInfoTest(unittest.TestCase): 11 """Tests the output of huddly-updater --info.""" 12 13 CHUNK_FILENAME = './samples/huddly-updater-info.log' 14 15 def test_parser(self): 16 want = { 17 'package': { 18 'app': '0.5.1', 19 'boot': '0.2.1', 20 'hw_rev': '6' 21 }, 22 'peripheral': { 23 'app': '0.5.1', 24 'boot': '0.2.1', 25 'hw_rev': '6' 26 } 27 } 28 29 with open(filename, 'r') as fhandle: 30 chunk = fhandle.read() 31 32 got = parse.parse_fw_vers(chunk) 33 self.assertDictEqual(want, got) 34 35 36if __name__ == '__main__': 37 unittest.main() 38