gitlab_hook: renaming module name (#51979)

* gitlab_hook: renaming module name

* gitlab_hook: rename module in documentation

* gitlab_hook: remove plural in docs and code

* gitlab_hook: fix unit test functions
pull/52017/head
Guillaume Martinez 6 years ago committed by Dag Wieers
parent 07cff73719
commit 7b84c0ee80

@ -16,10 +16,10 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = '''
---
module: gitlab_hooks
module: gitlab_hook
short_description: Manages GitLab project hooks.
description:
- Adds, updates and removes project hooks
- Adds, updates and removes project hook
version_added: "2.6"
author:
- Marcus Watkins (@marwatk)
@ -111,7 +111,7 @@ options:
EXAMPLES = '''
- name: "Adding a project hook"
gitlab_hooks:
gitlab_hook:
api_url: https://gitlab.example.com/
api_token: "{{ access_token }}"
project: "my_group/my_project"
@ -123,7 +123,7 @@ EXAMPLES = '''
token: "my-super-secret-token-that-my-ci-server-will-check"
- name: "Delete the previous hook"
gitlab_hooks:
gitlab_hook:
api_url: https://gitlab.example.com/
api_token: "{{ access_token }}"
project: "my_group/my_project"
@ -131,7 +131,7 @@ EXAMPLES = '''
state: absent
- name: "Delete a hook by numeric project id"
gitlab_hooks:
gitlab_hook:
api_url: https://gitlab.example.com/
api_token: "{{ access_token }}"
project: 10
@ -279,7 +279,7 @@ class GitLabHook(object):
@param project Project object
@param hook_url Url to call on event
'''
def existsHooks(self, project, hook_url):
def existsHook(self, project, hook_url):
# When project exists, object will be stored in self.projectObject.
hook = self.findHook(project, hook_url)
if hook:
@ -376,7 +376,7 @@ def main():
if project is None:
module.fail_json(msg="Failed to create hook: project %s doesn't exists" % project_identifier)
hook_exists = gitlab_hook.existsHooks(project, hook_url)
hook_exists = gitlab_hook.existsHook(project, hook_url)
if state == 'absent':
if hook_exists:

@ -5,7 +5,7 @@
from __future__ import absolute_import
from ansible.modules.source_control.gitlab_hooks import GitLabHook
from ansible.modules.source_control.gitlab_hook import GitLabHook
from .gitlab import (GitlabModuleTestCase,
python_version_match_requirement,
@ -31,11 +31,11 @@ class TestGitlabHook(GitlabModuleTestCase):
def test_hook_exist(self):
project = self.gitlab_instance.projects.get(1)
rvalue = self.moduleUtil.existsHooks(project, "http://example.com/hook")
rvalue = self.moduleUtil.existsHook(project, "http://example.com/hook")
self.assertEqual(rvalue, True)
rvalue = self.moduleUtil.existsHooks(project, "http://gitlab.com/hook")
rvalue = self.moduleUtil.existsHook(project, "http://gitlab.com/hook")
self.assertEqual(rvalue, False)
@ -72,7 +72,7 @@ class TestGitlabHook(GitlabModuleTestCase):
def test_delete_hook(self):
project = self.gitlab_instance.projects.get(1)
self.moduleUtil.existsHooks(project, "http://example.com/hook")
self.moduleUtil.existsHook(project, "http://example.com/hook")
rvalue = self.moduleUtil.deleteHook()
Loading…
Cancel
Save