blob: 20fcfe2bf77288761947225a22ec2914edf33962 [file] [log] [blame]
Alex Kleineb77ffa2019-05-28 14:47:44 -06001# -*- 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
8from __future__ import print_function
9
Alex Kleineb77ffa2019-05-28 14:47:44 -060010from chromite.lib import build_target_util
Alex Kleineb77ffa2019-05-28 14:47:44 -060011from chromite.lib import cros_test_lib
Alex Kleineb77ffa2019-05-28 14:47:44 -060012from chromite.service import packages
13
14
Alex Kleineb77ffa2019-05-28 14:47:44 -060015class 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 Burger1e0fe232019-07-01 14:52:07 -060031class 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('')