Merge pull request #4124 from beeankha/webhook_enhancement

Webhook Custom HTTP Method + Basic Auth Support

Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
softwarefactory-project-zuul[bot]
2019-07-24 21:06:23 +00:00
committed by GitHub
13 changed files with 107 additions and 17 deletions

View File

@@ -117,7 +117,7 @@ def mk_credential(name, credential_type='ssh', persisted=True):
def mk_notification_template(name, notification_type='webhook', configuration=None, organization=None, persisted=True):
nt = NotificationTemplate(name=name)
nt.notification_type = notification_type
nt.notification_configuration = configuration or dict(url="http://localhost", headers={"Test": "Header"})
nt.notification_configuration = configuration or dict(url="http://localhost", username="", password="", headers={"Test": "Header"})
if organization is not None:
nt.organization = organization
@@ -216,7 +216,7 @@ def mk_workflow_job_template(name, extra_vars='', spec=None, organization=None,
def mk_workflow_job_template_node(workflow_job_template=None,
unified_job_template=None,
unified_job_template=None,
success_nodes=None,
failure_nodes=None,
always_nodes=None,
@@ -231,11 +231,11 @@ def mk_workflow_job_template_node(workflow_job_template=None,
return workflow_node
def mk_workflow_job_node(unified_job_template=None,
def mk_workflow_job_node(unified_job_template=None,
success_nodes=None,
failure_nodes=None,
always_nodes=None,
workflow_job=None,
workflow_job=None,
job=None,
persisted=True):
workflow_node = WorkflowJobNode(unified_job_template=unified_job_template,
@@ -247,4 +247,3 @@ def mk_workflow_job_node(unified_job_template=None,
if persisted:
workflow_node.save()
return workflow_node

View File

@@ -385,7 +385,9 @@ def notification_template(organization):
organization=organization,
notification_type="webhook",
notification_configuration=dict(url="http://localhost",
headers={"Test": "Header"}))
username="",
password="",
headers={"Test": "Header",}))
@pytest.fixture

View File

@@ -92,7 +92,7 @@ def test_inherited_notification_templates(get, post, user, organization, project
isrc.save()
jt = JobTemplate.objects.create(name='test', inventory=i, project=project, playbook='debug.yml')
jt.save()
@pytest.mark.django_db
def test_notification_template_simple_patch(patch, notification_template, admin):
@@ -124,7 +124,7 @@ def test_custom_environment_injection(post, user, organization):
organization=organization.id,
notification_type="webhook",
notification_configuration=dict(url="https://example.org", disable_ssl_verification=False,
headers={"Test": "Header"})),
http_method="POST", headers={"Test": "Header"})),
u)
assert response.status_code == 201
template = NotificationTemplate.objects.get(pk=response.data['id'])