From e99500cf16a519476de3708206328940686a5d00 Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Thu, 2 Apr 2020 14:48:33 -0400 Subject: [PATCH] Mark test as xfail, move to unit testing --- awx_collection/test/awx/test_notification.py | 28 +++++++++++++++++++ .../targets/tower_notification/tasks/main.yml | 16 ----------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/awx_collection/test/awx/test_notification.py b/awx_collection/test/awx/test_notification.py index 33ea3cd488..f06b83b79e 100644 --- a/awx_collection/test/awx/test_notification.py +++ b/awx_collection/test/awx/test_notification.py @@ -82,3 +82,31 @@ def test_invalid_notification_configuration(run_module, admin_user, organization ), admin_user) assert result.get('failed', False), result.get('msg', result) assert 'Missing required fields for Notification Configuration' in result['msg'] + + +@pytest.mark.django_db +@pytest.mark.xfail(reason='Handling API validation changes w.r.t. changed status is an open item') +def test_deprecated_to_modern_no_op(run_module, admin_user, organization): + nt_config = { + 'url': 'http://www.example.com/hook', + 'headers': { + 'X-Custom-Header': 'value123' + } + } + result = run_module('tower_notification', dict( + name='foo-notification-template', + organization=organization.name, + notification_type='webhook', + notification_configuration=nt_config, + ), admin_user) + assert not result.get('failed', False), result.get('msg', result) + assert result.pop('changed', None), result + + result = run_module('tower_notification', dict( + name='foo-notification-template', + organization=organization.name, + notification_type='webhook', + notification_configuration=nt_config, + ), admin_user) + assert not result.get('failed', False), result.get('msg', result) + assert not result.pop('changed', None), result diff --git a/awx_collection/tests/integration/targets/tower_notification/tasks/main.yml b/awx_collection/tests/integration/targets/tower_notification/tasks/main.yml index 8ab933e8cb..03025e4b6a 100644 --- a/awx_collection/tests/integration/targets/tower_notification/tasks/main.yml +++ b/awx_collection/tests/integration/targets/tower_notification/tasks/main.yml @@ -114,22 +114,6 @@ that: - result is changed -- name: Recreate with notification_configuration - tower_notification: - name: "{{ webhook_not }}" - organization: Default - notification_type: webhook - notification_configuration: - url: http://www.example.com/hook - headers: - X-Custom-Header: value123 - state: present - register: result - -- assert: - that: - - result is not changed - - name: Delete webhook notification tower_notification: name: "{{ webhook_not }}"