Debian Codegraph @

ansible_collections/community/general/tests/unit/plugins/modules/test_homebrew.py

raw
1 # Copyright (c) Ansible project
2 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
3 # SPDX-License-Identifier: GPL-3.0-or-later
4
5 from __future__ import annotations
6
7 import unittest
8
9 from ansible_collections.community.general.plugins.module_utils._homebrew import HomebrewValidate
10
11
12 class TestHomebrewModule(unittest.TestCase):
13 def setUp(self):
14 self.brew_app_names = ["git-ssh", "awscli@1", "bash"]
15
16 self.invalid_names = [
17 "git ssh",
18 "git*",
19 ]
20
21 def test_valid_package_names(self):
22 for name in self.brew_app_names:
23 self.assertTrue(HomebrewValidate.valid_package(name))
24
25 def test_invalid_package_names(self):
26 for name in self.invalid_names:
27 self.assertFalse(HomebrewValidate.valid_package(name))