Alex Klein | eb77ffa | 2019-05-28 14:47:44 -0600 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | # Copyright 2019 The Chromium OS Authors. All rights reserved. |
| 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
| 5 | |
| 6 | """Packages service tests.""" |
| 7 | |
| 8 | from __future__ import print_function |
| 9 | |
Alex Klein | eb77ffa | 2019-05-28 14:47:44 -0600 | [diff] [blame] | 10 | from chromite.lib import build_target_util |
Alex Klein | eb77ffa | 2019-05-28 14:47:44 -0600 | [diff] [blame] | 11 | from chromite.lib import cros_test_lib |
Alex Klein | eb77ffa | 2019-05-28 14:47:44 -0600 | [diff] [blame] | 12 | from chromite.service import packages |
| 13 | |
| 14 | |
Alex Klein | eb77ffa | 2019-05-28 14:47:44 -0600 | [diff] [blame] | 15 | class UprevBuildTargetsTest(cros_test_lib.RunCommandTestCase): |
| 16 | """uprev_build_targets tests.""" |
| 17 | |
| 18 | def test_invalid_type_fails(self): |
| 19 | """Test invalid type fails.""" |
| 20 | with self.assertRaises(AssertionError): |
| 21 | packages.uprev_build_targets([build_target_util.BuildTarget('foo')], |
| 22 | 'invalid') |
| 23 | |
| 24 | def test_none_type_fails(self): |
| 25 | """Test None type fails.""" |
| 26 | with self.assertRaises(AssertionError): |
| 27 | packages.uprev_build_targets([build_target_util.BuildTarget('foo')], |
| 28 | None) |
| 29 | |
| 30 | |
David Burger | 1e0fe23 | 2019-07-01 14:52:07 -0600 | [diff] [blame] | 31 | class GetBestVisibleTest(cros_test_lib.MockTestCase): |
| 32 | """get_best_visible tests.""" |
| 33 | |
| 34 | def test_empty_atom_fails(self): |
| 35 | with self.assertRaises(AssertionError): |
| 36 | packages.get_best_visible('') |