| # -*- coding: utf-8 -*- |
| # Copyright 2019 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| """Packages service tests.""" |
| |
| from __future__ import print_function |
| |
| from chromite.lib import build_target_util |
| from chromite.lib import cros_test_lib |
| from chromite.service import packages |
| |
| |
| class UprevBuildTargetsTest(cros_test_lib.RunCommandTestCase): |
| """uprev_build_targets tests.""" |
| |
| def test_invalid_type_fails(self): |
| """Test invalid type fails.""" |
| with self.assertRaises(AssertionError): |
| packages.uprev_build_targets([build_target_util.BuildTarget('foo')], |
| 'invalid') |
| |
| def test_none_type_fails(self): |
| """Test None type fails.""" |
| with self.assertRaises(AssertionError): |
| packages.uprev_build_targets([build_target_util.BuildTarget('foo')], |
| None) |
| |
| |
| class GetBestVisibleTest(cros_test_lib.MockTestCase): |
| """get_best_visible tests.""" |
| |
| def test_empty_atom_fails(self): |
| with self.assertRaises(AssertionError): |
| packages.get_best_visible('') |