mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-11 11:21:05 +00:00
* Adjust all __future__ imports: for i in $(grep -REl "__future__.*absolute_import" plugins/ tests/); do sed -e 's/from __future__ import .*/from __future__ import annotations/g' -i $i; done * Remove all UTF-8 encoding specifications for Python source files: for i in $(grep -REl '[-][*]- coding: utf-8 -[*]-' plugins/ tests/); do sed -e '/^# -\*- coding: utf-8 -\*-/d' -i $i; done * Remove __metaclass__ = type: for i in $(grep -REl '__metaclass__ = type' plugins/ tests/); do sed -e '/^__metaclass__ = type/d' -i $i; done
29 lines
929 B
Python
29 lines
929 B
Python
# Copyright (c) Ansible project
|
|
# 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 annotations
|
|
|
|
|
|
from ansible_collections.community.internal_test_tools.tests.unit.compat import unittest
|
|
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.invalid_names = [
|
|
"git ssh",
|
|
"git*",
|
|
]
|
|
|
|
def test_valid_package_names(self):
|
|
for name in self.brew_app_names:
|
|
self.assertTrue(HomebrewValidate.valid_package(name))
|
|
|
|
def test_invalid_package_names(self):
|
|
for name in self.invalid_names:
|
|
self.assertFalse(HomebrewValidate.valid_package(name))
|