• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2023, The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15"""Tests for device_update.py"""
16
17import sys
18import unittest
19
20from atest import device_update
21
22
23class AdeviceUpdateMethodTest(unittest.TestCase):
24
25  @unittest.skipUnless(sys.platform.startswith('linux'), 'requires Linux')
26  def test_update_succeeds(self):
27    adevice = device_update.AdeviceUpdateMethod(adevice_path='/bin/true')
28
29    self.assertIsNone(adevice.update())
30
31  @unittest.skipUnless(sys.platform.startswith('linux'), 'requires Linux')
32  def test_update_fails(self):
33    adevice = device_update.AdeviceUpdateMethod(adevice_path='/bin/false')
34
35    self.assertRaises(device_update.Error, adevice.update)
36
37  def test_dependencies_non_empty(self):
38    adevice = device_update.AdeviceUpdateMethod()
39
40    deps = adevice.dependencies()
41
42    self.assertTrue(deps)
43