Debian Codegraph @

test/units/module_utils/test_distro.py

raw
1
2 # (c) 2018 Adrian Likins <[email protected]>
3 # Copyright (c) 2018 Ansible Project
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5 # or
6 # Apache License v2.0 (see http://www.apache.org/licenses/LICENSE-2.0)
7 #
8 # Dual licensed so any test cases could potentially be included by the upstream project
9 # that module_utils/distro.py is from (https://github.com/nir0s/distro)
10
11
12 # Note that nir0s/distro has many more tests in it's test suite. The tests here are
13 # primarily for testing the vendoring.
14
15 from __future__ import annotations
16
17 from ansible.module_utils import distro
18
19
20 # Generic test case with minimal assertions about specific returned values.
21 class TestDistro():
22 # should run on any platform without errors, even if non-linux without any
23 # useful info to return
24 def test_info(self):
25 info = distro.info()
26 assert isinstance(info, dict), \
27 'distro.info() returned %s (%s) which is not a dist' % (info, type(info))
28
29 def test_id(self):
30 id = distro.id()
31 assert isinstance(id, str), 'distro.id() returned %s (%s) which is not a string' % (id, type(id))