mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-29 20:39:09 -07:00
homebrew: Move repeated logic from homebrew modules into module_utils (#8324)
* gomebrew: Move repeated logic from homebrew modules into module_utils Fixes #8323. * ghangelog + unit test improvement * Update changelogs/fragments/8323-refactor-homebrew-logic-module-utils.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
136419c5c0
commit
3b7f13c58e
5 changed files with 145 additions and 177 deletions
|
@ -2,23 +2,28 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat import unittest
|
||||
from ansible_collections.community.general.plugins.modules.homebrew import Homebrew
|
||||
from ansible_collections.community.general.plugins.module_utils.homebrew import HomebrewValidate
|
||||
|
||||
|
||||
class TestHomebrewModule(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.brew_app_names = [
|
||||
'git-ssh',
|
||||
'awscli@1',
|
||||
'bash'
|
||||
self.brew_app_names = ["git-ssh", "awscli@1", "bash"]
|
||||
|
||||
self.invalid_names = [
|
||||
"git ssh",
|
||||
"git*",
|
||||
]
|
||||
|
||||
def test_valid_package_names(self):
|
||||
for name in self.brew_app_names:
|
||||
self.assertTrue(Homebrew.valid_package(name))
|
||||
self.assertTrue(HomebrewValidate.valid_package(name))
|
||||
|
||||
def test_invalid_package_names(self):
|
||||
for name in self.invalid_names:
|
||||
self.assertFalse(HomebrewValidate.valid_package(name))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue