Skip to content

Commit

Permalink
negative test for webhook task
Browse files Browse the repository at this point in the history
  • Loading branch information
pondrejk committed Nov 13, 2023
1 parent 5f0c2b0 commit f24cdef
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/foreman/api/test_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,27 @@ def test_positive_event_triggered(self, module_org, target_sat, setting_update):
repo.sync()
assert_event_triggered(shell, hook.event)
target_sat.wait_for_tasks(f'Deliver webhook {hook.name}')

@pytest.mark.tier1
@pytest.mark.parametrize('setting_update', ['safemode_render=False'], indirect=True)
def test_negative_event_task_failed(self, module_org, target_sat, setting_update):
"""Create a webhook with unreachable targete and assert the associated task
failed
:id: d4a49556-9413-46e8-bcb5-7afd0184bdb2
:expectedresults: Deliver webhook task fails
:CaseImportance: High
"""
hook = target_sat.api.Webhooks(
event='actions.katello.repository.sync_succeeded', http_method='GET'
).create()
repo = target_sat.api.Repository(
organization=module_org, content_type='yum', url='http://localhost/target'
).create()
with target_sat.session.shell() as shell:
shell.send('foreman-tail')
repo.sync()
assert_event_triggered(shell, hook.event)
target_sat.wait_for_tasks(f'Deliver webhook {hook.name}', must_succeed=False)

0 comments on commit f24cdef

Please sign in to comment.