blob: 72bd7f146f2eb731cfdbb2527d43a6eec825251e [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):
15 full_model = 'octopus_mimrock'
16 board = 'octopus'
17 model = 'mimrock'
18 self.assertEqual(build_utils.parse_full_model(full_model), (board, model))
19
20 def testParseModelNameWithFamily(self):
21 full_model = 'veyron_minnie_minnie'
22 board = 'veyron_minnie'
23 model = 'minnie'
24 self.assertEqual(build_utils.parse_full_model(full_model), (board, model))
25
26 def testParseInvalidFullModelRaisesException(self):
27 invalid_full_models = ['atlas',
28 'veyron_minnie_veyron_minnie',
29 '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()