blob: 63a60545f758f0e53cd01be0a3686721a5f86fbb [file] [log] [blame]
Shijin Abrahama8c74772020-01-24 09:39:25 -08001# Copyright 2020 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
5"""Module for build_utils unittests."""
6
7import unittest
8
9import build_utils
10
11
12class BuildUtilsTestCase(unittest.TestCase):
13
14 def testParseNormalModelName(self):
Xinan Lin6653d382020-03-03 10:41:13 -080015 full_model = 'board_model'
16 board = 'board'
17 model = 'model'
Shijin Abrahama8c74772020-01-24 09:39:25 -080018 self.assertEqual(build_utils.parse_full_model(full_model), (board, model))
19
Xinan Lin6653d382020-03-03 10:41:13 -080020 def testParseModelNameWithFamilyModel(self):
21 full_model = 'family_board_family_model'
22 board = 'family_board'
23 model = 'family_model'
Shijin Abrahama8c74772020-01-24 09:39:25 -080024 self.assertEqual(build_utils.parse_full_model(full_model), (board, model))
25
26 def testParseInvalidFullModelRaisesException(self):
27 invalid_full_models = ['atlas',
Xinan Lin6653d382020-03-03 10:41:13 -080028 'family_board_model',
Shijin Abrahama8c74772020-01-24 09:39:25 -080029 'too_long_name_a_name']
30 for invalid_model in invalid_full_models:
31 self.assertRaises(ValueError, build_utils.parse_full_model, invalid_model)
32
33if __name__ == '__main__':
34 unittest.main()