mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-09 05:27:17 +00:00
Reformat everything.
This commit is contained in:
parent
3f2213791a
commit
340ff8586d
1008 changed files with 61301 additions and 58309 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (c) 2019, Guillaume Martinez (lunik@tiwabbit.fr)
|
||||
# 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
|
||||
|
|
@ -20,12 +19,17 @@ def _dummy(x):
|
|||
|
||||
pytestmark = []
|
||||
try:
|
||||
from .gitlab import (GitlabModuleTestCase,
|
||||
python_version_match_requirement, python_gitlab_module_version,
|
||||
python_gitlab_version_match_requirement,
|
||||
resp_get_protected_branch, resp_get_project_by_name,
|
||||
resp_get_protected_branch_not_exist,
|
||||
resp_delete_protected_branch, resp_get_user)
|
||||
from .gitlab import (
|
||||
GitlabModuleTestCase,
|
||||
python_version_match_requirement,
|
||||
python_gitlab_module_version,
|
||||
python_gitlab_version_match_requirement,
|
||||
resp_get_protected_branch,
|
||||
resp_get_project_by_name,
|
||||
resp_get_protected_branch_not_exist,
|
||||
resp_delete_protected_branch,
|
||||
resp_get_user,
|
||||
)
|
||||
|
||||
# GitLab module requirements
|
||||
if python_version_match_requirement():
|
||||
|
|
@ -45,7 +49,7 @@ except ImportError:
|
|||
with_httmock = _dummy
|
||||
|
||||
|
||||
class MockProtectedBranch():
|
||||
class MockProtectedBranch:
|
||||
def __init__(self, merge_access_levels, push_access_levels):
|
||||
self.merge_access_levels = merge_access_levels
|
||||
self.push_access_levels = push_access_levels
|
||||
|
|
@ -58,7 +62,9 @@ class TestGitlabProtectedBranch(GitlabModuleTestCase):
|
|||
super().setUp()
|
||||
|
||||
self.gitlab_instance.user = self.gitlab_instance.users.get(1)
|
||||
self.moduleUtil = GitlabProtectedBranch(module=self.mock_module, project="foo-bar/diaspora-client", gitlab_instance=self.gitlab_instance)
|
||||
self.moduleUtil = GitlabProtectedBranch(
|
||||
module=self.mock_module, project="foo-bar/diaspora-client", gitlab_instance=self.gitlab_instance
|
||||
)
|
||||
|
||||
@with_httmock(resp_get_protected_branch)
|
||||
def test_protected_branch_exist(self):
|
||||
|
|
@ -75,10 +81,7 @@ class TestGitlabProtectedBranch(GitlabModuleTestCase):
|
|||
merge_access_levels=[{"access_level": 40}],
|
||||
push_access_levels=[{"access_level": 40}],
|
||||
)
|
||||
options = {
|
||||
"merge_access_levels": 40,
|
||||
"push_access_level": 40
|
||||
}
|
||||
options = {"merge_access_levels": 40, "push_access_level": 40}
|
||||
rvalue = self.moduleUtil.can_update(protected_branch, options)
|
||||
self.assertEqual(rvalue, True)
|
||||
|
||||
|
|
@ -87,10 +90,7 @@ class TestGitlabProtectedBranch(GitlabModuleTestCase):
|
|||
merge_access_levels=[{"access_level": 40}],
|
||||
push_access_levels=[{"access_level": 40}],
|
||||
)
|
||||
options = {
|
||||
"merge_access_levels": None,
|
||||
"push_access_level": None
|
||||
}
|
||||
options = {"merge_access_levels": None, "push_access_level": None}
|
||||
rvalue = self.moduleUtil.can_update(protected_branch, options)
|
||||
self.assertEqual(rvalue, True)
|
||||
|
||||
|
|
@ -99,10 +99,7 @@ class TestGitlabProtectedBranch(GitlabModuleTestCase):
|
|||
merge_access_levels=[{"access_level": 40}],
|
||||
push_access_levels=[{"access_level": 40}],
|
||||
)
|
||||
options = {
|
||||
"merge_access_levels": 40,
|
||||
"push_access_level": 30
|
||||
}
|
||||
options = {"merge_access_levels": 40, "push_access_level": 30}
|
||||
rvalue = self.moduleUtil.can_update(protected_branch, options)
|
||||
self.assertEqual(rvalue, False)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue