blob: 72c87fc6b90996f0713fbbc2170277639d6f0ee7 [file] [log] [blame]
Garry Wang111a26f2021-07-23 15:25:14 -07001# Copyright 2021 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 multi_duts_lib unittests."""
6
7
8import unittest
9import multi_duts_lib
10
11
12class MultiDUTsLibTestCase(unittest.TestCase):
13
14 def setUp(self):
15 self.secondary_targets = [
16 multi_duts_lib.BuildTarget(
17 board="nami",
18 model=None,
19 cros_build="nami-release/R92-12000.00"
20 ),
21 multi_duts_lib.BuildTarget(
22 board="coral",
23 model="babytiger",
24 cros_build="coral-release/R92-12000.00"
25 )
26 ]
27 self.stringified_targets = "nami,,nami-release/R92-12000.00;coral,babytiger,coral-release/R92-12000.00"
28
29 def testConvertSecondaryTargetsToString(self):
30 """Test convert a list of BuildTarget to string format."""
31 got = multi_duts_lib.convert_secondary_targets_to_string(self.secondary_targets)
32 want = self.stringified_targets
33 self.assertEqual(got, want)
34
35 def testRestructSecondaryTargetsFromString(self):
36 """Test restruct a list of BuildTarget from a string."""
37 got = multi_duts_lib.restruct_secondary_targets_from_string(self.stringified_targets)
38 want = self.secondary_targets
39 self.assertEqual(got, want)