summaryrefslogtreecommitdiffstats
path: root/ansible_collections/ibm/qradar/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/ibm/qradar/tests')
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/tasks/main.yml40
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/offense/tasks/main.yml29
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/defaults/main.yaml2
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/cli.yaml17
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/main.yaml4
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/redirection.yaml8
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_populate_log_sources_config.yaml18
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_remove_log_sources_config.yaml4
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/deleted.yaml12
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/gathered.yaml12
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/merged.yaml28
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/replaced.yaml30
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/rtt.yaml41
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/vars/main.yaml89
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/rule/tasks/main.yml40
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/compat/builtins.py34
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/compat/mock.py4
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/compat/unittest.py2
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/mock/loader.py5
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/mock/path.py8
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/mock/procenv.py8
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/mock/vault_helper.py6
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/mock/yaml_helper.py38
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/plugins/action/test_qradar_analytics_rules.py37
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/plugins/modules/conftest.py18
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/plugins/modules/utils.py9
26 files changed, 246 insertions, 297 deletions
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/tasks/main.yml b/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/tasks/main.yml
index cf547abcb..88ae78609 100644
--- a/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/tasks/main.yml
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/tasks/main.yml
@@ -1,60 +1,60 @@
---
- name: Create Testing Apache HTTP Server log source
log_source_management:
- name: "Testing Collections PB - 192.168.1.112"
- type_name: "Apache HTTP Server"
+ name: Testing Collections PB - 192.168.1.112
+ type_name: Apache HTTP Server
state: present
- description: "Testing Collection PB Description"
- identifier: "192.168.1.112"
+ description: Testing Collection PB Description
+ identifier: 192.168.1.112
register: snort_log_source_create
- name: Assert Create Test Apache HTTP Server log source changed
- assert:
+ ansible.builtin.assert:
that:
- snort_log_source_create is changed
- snort_log_source_create is not failed
- name: Create Testing Apache HTTP Server log source RERUN
log_source_management:
- name: "Testing Collections PB - 192.168.1.112"
- type_name: "Apache HTTP Server"
+ name: Testing Collections PB - 192.168.1.112
+ type_name: Apache HTTP Server
state: present
- description: "Testing Collection PB Description"
- identifier: "192.168.1.112"
+ description: Testing Collection PB Description
+ identifier: 192.168.1.112
register: snort_log_source_create_rerun
- name: Assert Create Test Apache HTTP Server log source is not changed on RERUN
- assert:
+ ansible.builtin.assert:
that:
- snort_log_source_create_rerun is not changed
- snort_log_source_create_rerun is not failed
- name: Delete Testing Apache HTTP Server log source
log_source_management:
- name: "Testing Collections PB - 192.168.1.112"
- type_name: "Apache HTTP Server"
+ name: Testing Collections PB - 192.168.1.112
+ type_name: Apache HTTP Server
state: absent
- description: "Testing Collection PB Description"
- identifier: "192.168.1.112"
+ description: Testing Collection PB Description
+ identifier: 192.168.1.112
register: snort_log_source_delete
- name: Assert Delete Test Apache HTTP Server log source changed
- assert:
+ ansible.builtin.assert:
that:
- snort_log_source_delete is changed
- snort_log_source_delete is not failed
- name: Delete Testing Apache HTTP Server log source RERUN
log_source_management:
- name: "Testing Collections PB - 192.168.1.112"
- type_name: "Apache HTTP Server"
+ name: Testing Collections PB - 192.168.1.112
+ type_name: Apache HTTP Server
state: absent
- description: "Testing Collection PB Description"
- identifier: "192.168.1.112"
+ description: Testing Collection PB Description
+ identifier: 192.168.1.112
register: snort_log_source_delete_rerun
- name: Assert Delete Test Apache HTTP Server log source is not changed on RERUN
- assert:
+ ansible.builtin.assert:
that:
- snort_log_source_delete_rerun is not changed
- snort_log_source_delete_rerun is not failed
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/offense/tasks/main.yml b/ansible_collections/ibm/qradar/tests/integration/targets/offense/tasks/main.yml
index 7495ec9b8..f93cb9657 100644
--- a/ansible_collections/ibm/qradar/tests/integration/targets/offense/tasks/main.yml
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/offense/tasks/main.yml
@@ -1,19 +1,18 @@
---
-
-#- qradar_offense_action:
-# id: 1
-# status: "hidden"
-# assigned_to: "admin"
-# protected: false
+# - qradar_offense_action:
+# id: 1
+# status: "hidden"
+# assigned_to: "admin"
+# protected: false
#
-#- qradar_offense_note:
-# offense_id: 2
-# note_text: "testing note text from playbook - modified"
+# - qradar_offense_note:
+# offense_id: 2
+# note_text: "testing note text from playbook - modified"
#
-#- name: get info about qradar offense
-# qradar_offense_info:
-# protected: true
-# status: "HIDDEN"
-# register: offense_info
+# - name: get info about qradar offense
+# qradar_offense_info:
+# protected: true
+# status: "HIDDEN"
+# register: offense_info
#
-#- debug: var=offense_info
+# - debug: var=offense_info
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/defaults/main.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/defaults/main.yaml
index 10c0fabcb..5f709c5aa 100644
--- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/defaults/main.yaml
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/defaults/main.yaml
@@ -1,2 +1,2 @@
---
-testcase: '*'
+testcase: "*"
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/cli.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/cli.yaml
index dc4768b5c..2d5ece550 100644
--- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/cli.yaml
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/cli.yaml
@@ -1,18 +1,19 @@
---
-- name: collect all cli test cases
- find:
- paths: '{{ role_path }}/tests/cli'
- patterns: '{{ testcase }}.yaml'
+- name: Collect all cli test cases
+ ansible.builtin.find:
+ paths: "{{ role_path }}/tests/cli"
+ patterns: "{{ testcase }}.yaml"
register: test_cases
-- name: set test_items
- set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
+- name: Set test_items
+ ansible.builtin.set_fact:
+ test_items: "{{ test_cases.files | map(attribute='path') | list }}"
- name: Run test case (connection=ansible.netcommon.httpapi)
- include: '{{ test_case_to_run }}'
+ ansible.builtin._include: "{{ test_case_to_run }}"
vars:
ansible_connection: ansible.netcommon.httpapi
- with_items: '{{ test_items }}'
+ with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
tags: connection_httpapi
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/main.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/main.yaml
index 62cc1ae1e..098fa1e5a 100644
--- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/main.yaml
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/main.yaml
@@ -1,7 +1,7 @@
---
-- include: cli.yaml
+- ansible.builtin._include: cli.yaml
tags:
- cli
-- include: redirection.yaml
+- ansible.builtin._include: redirection.yaml
when: ansible_version.full is version('2.10.0', '>=')
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/redirection.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/redirection.yaml
index a57054c7d..9172f3018 100644
--- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/redirection.yaml
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/redirection.yaml
@@ -1,6 +1,6 @@
---
-- name: collect all cli test cases
- find:
- paths: '{{ role_path }}/tests/redirection'
- patterns: '{{ testcase }}.yaml'
+- name: Collect all cli test cases
+ ansible.builtin.find:
+ paths: "{{ role_path }}/tests/redirection"
+ patterns: "{{ testcase }}.yaml"
register: test_cases
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_populate_log_sources_config.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_populate_log_sources_config.yaml
index 0b8e6b8f6..7c1608c00 100644
--- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_populate_log_sources_config.yaml
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_populate_log_sources_config.yaml
@@ -1,14 +1,14 @@
---
- name: Populate Log Sources Management for tests
tags: merged
- ibm.qradar.qradar_log_sources_management: &id001
+ ibm.qradar.qradar_log_sources_management:
state: merged
config:
- - name: "Snort logs"
- type_name: "Snort Open Source IDS"
- description: "Snort IDS remote logs from rsyslog"
- identifier: "192.0.2.1"
- - name: "Apache HTTP Server logs"
- type_name: "Apache HTTP Server"
- description: "Apache HTTP Server remote logs from rsyslog"
- identifier: "198.51.100.1" \ No newline at end of file
+ - name: Snort logs
+ type_name: Snort Open Source IDS
+ description: Snort IDS remote logs from rsyslog
+ identifier: 192.0.2.1
+ - name: Apache HTTP Server logs
+ type_name: Apache HTTP Server
+ description: Apache HTTP Server remote logs from rsyslog
+ identifier: 198.51.100.1
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_remove_log_sources_config.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_remove_log_sources_config.yaml
index e7f5896be..ed0cc55c4 100644
--- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_remove_log_sources_config.yaml
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_remove_log_sources_config.yaml
@@ -3,5 +3,5 @@
ibm.qradar.qradar_log_sources_management:
state: deleted
config:
- - name: "Snort logs"
- - name: "Apache HTTP Server logs" \ No newline at end of file
+ - name: Snort logs
+ - name: Apache HTTP Server logs
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/deleted.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/deleted.yaml
index f5c70826b..21df8087f 100644
--- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/deleted.yaml
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/deleted.yaml
@@ -1,27 +1,24 @@
---
- debug:
- msg: Start Deleted integration state for qradar_log_sources_management ansible_connection={{ ansible_connection
- }}
+ msg: Start Deleted integration state for qradar_log_sources_management ansible_connection={{ ansible_connection }}
- include_tasks: _remove_log_sources_config.yaml
- include_tasks: _populate_log_sources_config.yaml
- block:
-
- name: Delete attributes of provided configured Log Sources Management
register: result
ibm.qradar.qradar_log_sources_management: &id001
config:
- - name: "Snort logs"
- - name: "Apache HTTP Server logs"
+ - name: Snort logs
+ - name: Apache HTTP Server logs
state: deleted
- assert:
that:
- result.changed == true
- - "{{ merged['after'] | symmetric_difference(result['qradar_log_sources_management']['before']) |\
- \ length == 4 }}"
+ - "{{ merged['after'] | symmetric_difference(result['qradar_log_sources_management']['before']) | length == 4 }}"
- merged['before'] == result['qradar_log_sources_management']['after']
- name: Delete attributes of all configured Log Sources Management (IDEMPOTENT)
@@ -34,5 +31,4 @@
- result.changed == false
always:
-
- include_tasks: _remove_log_sources_config.yaml
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/gathered.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/gathered.yaml
index c30ad1646..4539c444a 100644
--- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/gathered.yaml
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/gathered.yaml
@@ -1,27 +1,23 @@
---
- debug:
- msg: START qradar_log_sources_management gathered integration tests on connection={{ ansible_connection
- }}
+ msg: START qradar_log_sources_management gathered integration tests on connection={{ ansible_connection }}
- include_tasks: _remove_log_sources_config.yaml
- include_tasks: _populate_log_sources_config.yaml
- block:
-
- name: Gather the provided configuration with the exisiting running configuration
register: result
ibm.qradar.qradar_log_sources_management:
config:
- - name: "Snort logs"
- - name: "Apache HTTP Server logs"
+ - name: Snort logs
+ - name: Apache HTTP Server logs
state: gathered
- assert:
that:
- - "{{ merged['after'] | symmetric_difference(result['gathered']) |\
- \ length == 4 }}"
+ - "{{ merged['after'] | symmetric_difference(result['gathered']) | length == 4 }}"
- result['changed'] == false
always:
-
- include_tasks: _remove_log_sources_config.yaml
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/merged.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/merged.yaml
index 224671edb..d4cd1a2aa 100644
--- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/merged.yaml
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/merged.yaml
@@ -1,26 +1,24 @@
---
- debug:
- msg: START Merged qradar_log_sources_management state for integration tests on connection={{
- ansible_connection }}
+ msg: START Merged qradar_log_sources_management state for integration tests on connection={{ ansible_connection }}
- include_tasks: _remove_log_sources_config.yaml
- block:
-
- name: Merge and Create new Log Sources Management
tags: merged
register: result
ibm.qradar.qradar_log_sources_management: &id001
state: merged
config:
- - name: "Snort logs"
- type_name: "Snort Open Source IDS"
- description: "Snort IDS remote logs from rsyslog"
- identifier: "192.0.2.1"
- - name: "Apache HTTP Server logs"
- type_name: "Apache HTTP Server"
- description: "Apache HTTP Server remote logs from rsyslog"
- identifier: "198.51.100.1"
+ - name: Snort logs
+ type_name: Snort Open Source IDS
+ description: Snort IDS remote logs from rsyslog
+ identifier: 192.0.2.1
+ - name: Apache HTTP Server logs
+ type_name: Apache HTTP Server
+ description: Apache HTTP Server remote logs from rsyslog
+ identifier: 198.51.100.1
- name: To remove creation_date from the after dict
set_fact:
@@ -28,7 +26,7 @@
when: "{{item.key not in ['creation_date']}}"
with_dict: "{{ dict }}"
loop: "{{ result['qradar_log_sources_management']['after'] }}"
-
+
- name: To remove modified_date from the after dict
set_fact:
after: "{{ after | default([]) | combine({ item.key : item.value }) }}"
@@ -47,8 +45,7 @@
assert:
that:
- result['changed'] == true
- - "{{ merged['after'] | symmetric_difference(result['qradar_log_sources_management']['after']) |\
- \ length == 4 }}"
+ - "{{ merged['after'] | symmetric_difference(result['qradar_log_sources_management']['after']) | length == 4 }}"
- name: Assert that before dicts are correctly generated
assert:
@@ -65,5 +62,4 @@
- result['changed'] == false
always:
-
- - include_tasks: _remove_log_sources_config.yaml \ No newline at end of file
+ - include_tasks: _remove_log_sources_config.yaml
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/replaced.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/replaced.yaml
index d8dfd7373..bc241ed9e 100644
--- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/replaced.yaml
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/replaced.yaml
@@ -1,37 +1,32 @@
---
- debug:
- msg: START Replaced qradar_log_sources_management state for integration tests on connection={{ ansible_connection
- }}
+ msg: START Replaced qradar_log_sources_management state for integration tests on connection={{ ansible_connection }}
- include_tasks: _remove_log_sources_config.yaml
- include_tasks: _populate_log_sources_config.yaml
- block:
-
- name: Replace existing Log Sources Management
register: result
ibm.qradar.qradar_log_sources_management: &id001
state: replaced
config:
- - name: "Snort logs"
- type_name: "Snort Open Source IDS"
- description: "REPLACED Snort IDS remote logs from rsyslog"
- identifier: "198.51.100.1"
- - name: "Apache HTTP Server logs"
- type_name: "Apache HTTP Server"
- description: "REPLACED Apache HTTP Server remote logs from rsyslog"
- identifier: "192.0.2.1"
+ - name: Snort logs
+ type_name: Snort Open Source IDS
+ description: REPLACED Snort IDS remote logs from rsyslog
+ identifier: 198.51.100.1
+ - name: Apache HTTP Server logs
+ type_name: Apache HTTP Server
+ description: REPLACED Apache HTTP Server remote logs from rsyslog
+ identifier: 192.0.2.1
- assert:
that:
- result.changed == true
- - "{{ merged['after'] | symmetric_difference(result['qradar_log_sources_management']['before']) |\
- \ length == 4 }}"
- - "{{ replaced['after'] | symmetric_difference(result['qradar_log_sources_management']['after']) |\
- \ length == 4 }}"
+ - "{{ merged['after'] | symmetric_difference(result['qradar_log_sources_management']['before']) | length == 4 }}"
+ - "{{ replaced['after'] | symmetric_difference(result['qradar_log_sources_management']['after']) | length == 4 }}"
- - name: Replaces device configuration of listed Log Sources Management with provided configuration
- (IDEMPOTENT)
+ - name: Replaces device configuration of listed Log Sources Management with provided configuration (IDEMPOTENT)
register: result
ibm.qradar.qradar_log_sources_management: *id001
@@ -41,5 +36,4 @@
- result['changed'] == false
always:
-
- include_tasks: _remove_log_sources_config.yaml
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/rtt.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/rtt.yaml
index 0536a6a73..c7c6230ae 100644
--- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/rtt.yaml
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/rtt.yaml
@@ -1,51 +1,47 @@
---
- debug:
- msg: START qradar_log_sources_management round trip integration tests on connection={{ ansible_connection
- }}
+ msg: START qradar_log_sources_management round trip integration tests on connection={{ ansible_connection }}
- include_tasks: _remove_log_sources_config.yaml
- block:
-
- name: Apply the provided configuration (base config)
register: base_config
- ibm.qradar.qradar_log_sources_management: &id001
+ ibm.qradar.qradar_log_sources_management:
state: merged
config:
- - name: "Snort logs"
- type_name: "Snort Open Source IDS"
- description: "Snort IDS remote logs from rsyslog"
- identifier: "192.0.2.1"
- - name: "Apache HTTP Server logs"
- type_name: "Apache HTTP Server"
- description: "Apache HTTP Server remote logs from rsyslog"
- identifier: "198.51.100.1"
+ - name: Snort logs
+ type_name: Snort Open Source IDS
+ description: Snort IDS remote logs from rsyslog
+ identifier: 192.0.2.1
+ - name: Apache HTTP Server logs
+ type_name: Apache HTTP Server
+ description: Apache HTTP Server remote logs from rsyslog
+ identifier: 198.51.100.1
- name: Gather Qradar Log Sources Management facts
register: gather_result
ibm.qradar.qradar_log_sources_management:
config:
- - name: "Snort logs"
- - name: "Apache HTTP Server logs"
+ - name: Snort logs
+ - name: Apache HTTP Server logs
state: gathered
- name: Apply the configuration which need to be reverted
register: result
ibm.qradar.qradar_log_sources_management:
config:
- - name: "Snort logs"
- type_name: "Snort Open Source IDS"
- description: "REPLACED Snort IDS remote logs from rsyslog"
- identifier: "198.51.100.1"
+ - name: Snort logs
+ type_name: Snort Open Source IDS
+ description: REPLACED Snort IDS remote logs from rsyslog
+ identifier: 198.51.100.1
state: replaced
- assert:
that:
- result.changed == true
- - "{{ merged['before'] | symmetric_difference(result['qradar_log_sources_management']['before']) |\
- \ length == 1 }}"
- - "{{ replaced['after'] | symmetric_difference(result['qradar_log_sources_management']['after']) |\
- \ length == 3 }}"
+ - "{{ merged['before'] | symmetric_difference(result['qradar_log_sources_management']['before']) | length == 1 }}"
+ - "{{ replaced['after'] | symmetric_difference(result['qradar_log_sources_management']['after']) | length == 3 }}"
- name: Revert back to base config using facts round trip
register: revert
@@ -58,5 +54,4 @@
- revert['changed'] == true
always:
-
- include_tasks: _remove_log_sources_config.yaml
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/vars/main.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/vars/main.yaml
index 7e7c63c52..488ca2746 100644
--- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/vars/main.yaml
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/vars/main.yaml
@@ -1,7 +1,6 @@
---
merged:
before: []
-
after:
- auto_discovered: false
average_eps: 0
@@ -11,30 +10,30 @@ merged:
enabled: true
gateway: false
group_ids:
- - 0
+ - 0
internal: false
language_id: 1
last_event_time: 0
- log_source_extension_id: null
+ log_source_extension_id:
name: Snort logs
protocol_parameters:
- - id: 1
- name: incomingPayloadEncoding
- value: UTF-8
- - id: 0
- name: identifier
- value: 192.0.2.1
+ - id: 1
+ name: incomingPayloadEncoding
+ value: UTF-8
+ - id: 0
+ name: identifier
+ value: 192.0.2.1
protocol_type_id: 0
requires_deploy: true
status:
last_updated: 0
- messages: null
+ messages:
status: NA
store_event_payload: true
target_event_collector_id: 7
type_id: 2
- wincollect_external_destination_ids: null
- wincollect_internal_destination_id: null
+ wincollect_external_destination_ids:
+ wincollect_internal_destination_id:
- auto_discovered: false
average_eps: 0
coalesce_events: true
@@ -43,30 +42,30 @@ merged:
enabled: true
gateway: false
group_ids:
- - 0
+ - 0
internal: false
language_id: 1
last_event_time: 0
- log_source_extension_id: null
+ log_source_extension_id:
name: Apache HTTP Server logs
protocol_parameters:
- - id: 1
- name: incomingPayloadEncoding
- value: UTF-8
- - id: 0
- name: identifier
- value: 198.51.100.1
+ - id: 1
+ name: incomingPayloadEncoding
+ value: UTF-8
+ - id: 0
+ name: identifier
+ value: 198.51.100.1
protocol_type_id: 0
requires_deploy: true
status:
last_updated: 0
- messages: null
+ messages:
status: NA
store_event_payload: true
target_event_collector_id: 7
type_id: 10
- wincollect_external_destination_ids: null
- wincollect_internal_destination_id: null
+ wincollect_external_destination_ids:
+ wincollect_internal_destination_id:
replaced:
after:
@@ -78,30 +77,30 @@ replaced:
enabled: true
gateway: false
group_ids:
- - 0
+ - 0
internal: false
language_id: 1
last_event_time: 0
- log_source_extension_id: null
+ log_source_extension_id:
name: Snort logs
protocol_parameters:
- - id: 1
- name: incomingPayloadEncoding
- value: UTF-8
- - id: 0
- name: identifier
- value: 198.51.100.1
+ - id: 1
+ name: incomingPayloadEncoding
+ value: UTF-8
+ - id: 0
+ name: identifier
+ value: 198.51.100.1
protocol_type_id: 0
requires_deploy: true
status:
last_updated: 0
- messages: null
+ messages:
status: NA
store_event_payload: true
target_event_collector_id: 7
type_id: 2
- wincollect_external_destination_ids: null
- wincollect_internal_destination_id: null
+ wincollect_external_destination_ids:
+ wincollect_internal_destination_id:
- auto_discovered: false
average_eps: 0
coalesce_events: true
@@ -110,27 +109,27 @@ replaced:
enabled: true
gateway: false
group_ids:
- - 0
+ - 0
internal: false
language_id: 1
last_event_time: 0
- log_source_extension_id: null
+ log_source_extension_id:
name: Apache HTTP Server logs
protocol_parameters:
- - id: 1
- name: incomingPayloadEncoding
- value: UTF-8
- - id: 0
- name: identifier
- value: 192.0.2.1
+ - id: 1
+ name: incomingPayloadEncoding
+ value: UTF-8
+ - id: 0
+ name: identifier
+ value: 192.0.2.1
protocol_type_id: 0
requires_deploy: true
status:
last_updated: 0
- messages: null
+ messages:
status: NA
store_event_payload: true
target_event_collector_id: 7
type_id: 10
- wincollect_external_destination_ids: null
- wincollect_internal_destination_id: null
+ wincollect_external_destination_ids:
+ wincollect_internal_destination_id:
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/rule/tasks/main.yml b/ansible_collections/ibm/qradar/tests/integration/targets/rule/tasks/main.yml
index 142fd613d..b72873a3d 100644
--- a/ansible_collections/ibm/qradar/tests/integration/targets/rule/tasks/main.yml
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/rule/tasks/main.yml
@@ -1,55 +1,57 @@
---
-- name: get info about qradar offense
+- name: Get info about qradar offense
rule_info:
- name: "Service DoS Attack Detected"
+ name: Service DoS Attack Detected
register: rule_info
-- debug: var=rule_info
+- name: Debug rule_info
+ ansible.builtin.debug:
+ var: rule_info
-- name: enable rule by id
+- name: Enable rule by id
rule:
state: enabled
- id: "{{ rule_info['rules'][0]['id']|int }}"
+ id: "{{ rule_info['rules'][0]['id'] | int }}"
register: enable_rule_by_id
-- name: ensure enable rule by id
- assert:
+- name: Ensure enable rule by id
+ ansible.builtin.assert:
that:
- enable_rule_by_id is changed
- enable_rule_by_id is not failed
-- name: enable rule by id again
+- name: Enable rule by id again
rule:
state: enabled
- id: "{{ rule_info['rules'][0]['id']|int }}"
+ id: "{{ rule_info['rules'][0]['id'] | int }}"
register: enable_rule_by_id_again
-- name: ensure enable rule by id again
- assert:
+- name: Ensure enable rule by id again
+ ansible.builtin.assert:
that:
- enable_rule_by_id_again is not changed
- enable_rule_by_id_again is not failed
-- name: disable rule by id
+- name: Disable rule by id
rule:
state: disabled
- id: "{{ rule_info['rules'][0]['id']|int }}"
+ id: "{{ rule_info['rules'][0]['id'] | int }}"
register: disable_rule_by_id
-- name: ensure disable rule by id
- assert:
+- name: Ensure disable rule by id
+ ansible.builtin.assert:
that:
- disable_rule_by_id is changed
- disable_rule_by_id is not failed
-- name: disable rule by id again
+- name: Disable rule by id again
rule:
state: disabled
- id: "{{ rule_info['rules'][0]['id']|int }}"
+ id: "{{ rule_info['rules'][0]['id'] | int }}"
register: disable_rule_by_id_again
-- name: ensure disable rule by id again
- assert:
+- name: Ensure disable rule by id again
+ ansible.builtin.assert:
that:
- disable_rule_by_id_again is not changed
- disable_rule_by_id_again is not failed
diff --git a/ansible_collections/ibm/qradar/tests/unit/compat/builtins.py b/ansible_collections/ibm/qradar/tests/unit/compat/builtins.py
deleted file mode 100644
index bfc8adfbe..000000000
--- a/ansible_collections/ibm/qradar/tests/unit/compat/builtins.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
-#
-# This file is part of Ansible
-#
-# Ansible is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Ansible is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
-
-# Make coding more python3-ish
-from __future__ import absolute_import, division, print_function
-
-__metaclass__ = type
-
-#
-# Compat for python2.7
-#
-
-# One unittest needs to import builtins via __import__() so we need to have
-# the string that represents it
-try:
- import __builtin__
-except ImportError:
- BUILTINS = "builtins"
-else:
- BUILTINS = "__builtin__"
diff --git a/ansible_collections/ibm/qradar/tests/unit/compat/mock.py b/ansible_collections/ibm/qradar/tests/unit/compat/mock.py
index 2ea98a17f..61ac88700 100644
--- a/ansible_collections/ibm/qradar/tests/unit/compat/mock.py
+++ b/ansible_collections/ibm/qradar/tests/unit/compat/mock.py
@@ -19,6 +19,7 @@
# Make coding more python3-ish
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -26,6 +27,7 @@ Compat module for Python3.x's unittest.mock module
"""
import sys
+
# Python 2.7
# Note: Could use the pypi mock library on python3.x as well as python2.x. It
@@ -104,7 +106,7 @@ if sys.version_info >= (3,) and sys.version_info < (3, 4, 4):
import _io
file_spec = list(
- set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO)))
+ set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))),
)
if mock is None:
diff --git a/ansible_collections/ibm/qradar/tests/unit/compat/unittest.py b/ansible_collections/ibm/qradar/tests/unit/compat/unittest.py
index df3379b82..df4266ec9 100644
--- a/ansible_collections/ibm/qradar/tests/unit/compat/unittest.py
+++ b/ansible_collections/ibm/qradar/tests/unit/compat/unittest.py
@@ -18,6 +18,7 @@
# Make coding more python3-ish
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -26,6 +27,7 @@ Compat module for Python2.7's unittest module
import sys
+
# Allow wildcard import because we really do want to import all of
# unittests's symbols into this compat shim
# pylint: disable=wildcard-import,unused-wildcard-import
diff --git a/ansible_collections/ibm/qradar/tests/unit/mock/loader.py b/ansible_collections/ibm/qradar/tests/unit/mock/loader.py
index 19c44a7e8..011c67b29 100644
--- a/ansible_collections/ibm/qradar/tests/unit/mock/loader.py
+++ b/ansible_collections/ibm/qradar/tests/unit/mock/loader.py
@@ -18,19 +18,20 @@
# Make coding more python3-ish
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
import os
from ansible.errors import AnsibleParserError
-from ansible.parsing.dataloader import DataLoader
from ansible.module_utils._text import to_bytes, to_text
+from ansible.parsing.dataloader import DataLoader
class DictDataLoader(DataLoader):
def __init__(self, file_mapping=None):
file_mapping = {} if file_mapping is None else file_mapping
- assert type(file_mapping) == dict
+ assert isinstance(file_mapping, dict)
super(DictDataLoader, self).__init__()
diff --git a/ansible_collections/ibm/qradar/tests/unit/mock/path.py b/ansible_collections/ibm/qradar/tests/unit/mock/path.py
index 1e5902864..f69b4822b 100644
--- a/ansible_collections/ibm/qradar/tests/unit/mock/path.py
+++ b/ansible_collections/ibm/qradar/tests/unit/mock/path.py
@@ -1,12 +1,12 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
-from ansible_collections.trendmicro.deepsec.tests.unit.compat.mock import (
- MagicMock,
-)
from ansible.utils.path import unfrackpath
+from ansible_collections.trendmicro.deepsec.tests.unit.compat.mock import MagicMock
mock_unfrackpath_noop = MagicMock(
- spec_set=unfrackpath, side_effect=lambda x, *args, **kwargs: x
+ spec_set=unfrackpath,
+ side_effect=lambda x, *args, **kwargs: x,
)
diff --git a/ansible_collections/ibm/qradar/tests/unit/mock/procenv.py b/ansible_collections/ibm/qradar/tests/unit/mock/procenv.py
index f7ab5fe91..83c7d00bd 100644
--- a/ansible_collections/ibm/qradar/tests/unit/mock/procenv.py
+++ b/ansible_collections/ibm/qradar/tests/unit/mock/procenv.py
@@ -19,16 +19,18 @@
# Make coding more python3-ish
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
-import sys
import json
+import sys
from contextlib import contextmanager
from io import BytesIO, StringIO
-from ansible_collections.trendmicro.deepsec.tests.unit.compat import unittest
-from ansible.module_utils.six import PY3
+
from ansible.module_utils._text import to_bytes
+from ansible.module_utils.six import PY3
+from ansible_collections.trendmicro.deepsec.tests.unit.compat import unittest
@contextmanager
diff --git a/ansible_collections/ibm/qradar/tests/unit/mock/vault_helper.py b/ansible_collections/ibm/qradar/tests/unit/mock/vault_helper.py
index b34ae1340..82d01f5c5 100644
--- a/ansible_collections/ibm/qradar/tests/unit/mock/vault_helper.py
+++ b/ansible_collections/ibm/qradar/tests/unit/mock/vault_helper.py
@@ -14,10 +14,10 @@
# Make coding more python3-ish
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from ansible.module_utils._text import to_bytes
-
from ansible.parsing.vault import VaultSecret
@@ -38,5 +38,7 @@ class TextVaultSecret(VaultSecret):
def bytes(self):
"""The text encoded with encoding, unless we specifically set _bytes."""
return self._bytes or to_bytes(
- self.text, encoding=self.encoding, errors=self.errors
+ self.text,
+ encoding=self.encoding,
+ errors=self.errors,
)
diff --git a/ansible_collections/ibm/qradar/tests/unit/mock/yaml_helper.py b/ansible_collections/ibm/qradar/tests/unit/mock/yaml_helper.py
index 5df30aaed..e46d3180b 100644
--- a/ansible_collections/ibm/qradar/tests/unit/mock/yaml_helper.py
+++ b/ansible_collections/ibm/qradar/tests/unit/mock/yaml_helper.py
@@ -1,12 +1,14 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
import io
+
import yaml
from ansible.module_utils.six import PY3
-from ansible.parsing.yaml.loader import AnsibleLoader
from ansible.parsing.yaml.dumper import AnsibleDumper
+from ansible.parsing.yaml.loader import AnsibleLoader
class YamlTestUtils(object):
@@ -45,7 +47,8 @@ class YamlTestUtils(object):
# dump the gen 2 objects directory to strings
string_from_object_dump_2 = self._dump_string(
- obj_2, dumper=AnsibleDumper
+ obj_2,
+ dumper=AnsibleDumper,
)
# The gen 1 and gen 2 yaml strings
@@ -59,7 +62,8 @@ class YamlTestUtils(object):
obj_3 = loader_3.get_data()
string_from_object_dump_3 = self._dump_string(
- obj_3, dumper=AnsibleDumper
+ obj_3,
+ dumper=AnsibleDumper,
)
self.assertEqual(obj, obj_3)
@@ -93,10 +97,14 @@ class YamlTestUtils(object):
if PY3:
yaml.dump(
- obj_from_stream, stream_obj_from_stream, Dumper=AnsibleDumper
+ obj_from_stream,
+ stream_obj_from_stream,
+ Dumper=AnsibleDumper,
)
yaml.dump(
- obj_from_stream, stream_obj_from_string, Dumper=AnsibleDumper
+ obj_from_stream,
+ stream_obj_from_string,
+ Dumper=AnsibleDumper,
)
else:
yaml.dump(
@@ -120,25 +128,27 @@ class YamlTestUtils(object):
if PY3:
yaml_string_obj_from_stream = yaml.dump(
- obj_from_stream, Dumper=AnsibleDumper
+ obj_from_stream,
+ Dumper=AnsibleDumper,
)
yaml_string_obj_from_string = yaml.dump(
- obj_from_string, Dumper=AnsibleDumper
+ obj_from_string,
+ Dumper=AnsibleDumper,
)
else:
yaml_string_obj_from_stream = yaml.dump(
- obj_from_stream, Dumper=AnsibleDumper, encoding=None
+ obj_from_stream,
+ Dumper=AnsibleDumper,
+ encoding=None,
)
yaml_string_obj_from_string = yaml.dump(
- obj_from_string, Dumper=AnsibleDumper, encoding=None
+ obj_from_string,
+ Dumper=AnsibleDumper,
+ encoding=None,
)
assert yaml_string == yaml_string_obj_from_stream
- assert (
- yaml_string
- == yaml_string_obj_from_stream
- == yaml_string_obj_from_string
- )
+ assert yaml_string == yaml_string_obj_from_stream == yaml_string_obj_from_string
assert (
yaml_string
== yaml_string_obj_from_stream
diff --git a/ansible_collections/ibm/qradar/tests/unit/plugins/action/test_qradar_analytics_rules.py b/ansible_collections/ibm/qradar/tests/unit/plugins/action/test_qradar_analytics_rules.py
index 390992698..c24441308 100644
--- a/ansible_collections/ibm/qradar/tests/unit/plugins/action/test_qradar_analytics_rules.py
+++ b/ansible_collections/ibm/qradar/tests/unit/plugins/action/test_qradar_analytics_rules.py
@@ -18,19 +18,18 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
-import unittest
import tempfile
+import unittest
+
from ansible.playbook.task import Task
from ansible.template import Templar
-from ansible_collections.ibm.qradar.plugins.action.qradar_analytics_rules import (
- ActionModule,
-)
-from ansible_collections.ansible.utils.tests.unit.compat.mock import (
- MagicMock,
- patch,
-)
+from ansible_collections.ansible.utils.tests.unit.compat.mock import MagicMock, patch
+
+from ansible_collections.ibm.qradar.plugins.action.qradar_analytics_rules import ActionModule
+
RESPONSE_PAYLOAD = {
"average_capacity": "null",
@@ -64,7 +63,7 @@ class TestQradarAnalyticsRules(unittest.TestCase):
# Ansible <= 2.13 looks for check_mode in play_context
play_context.check_mode = False
connection = patch(
- "ansible_collections.ibm.qradar.plugins.action.qradar_analytics_rules.Connection"
+ "ansible_collections.ibm.qradar.plugins.action.qradar_analytics_rules.Connection",
)
fake_loader = {}
templar = Templar(loader=fake_loader)
@@ -83,9 +82,7 @@ class TestQradarAnalyticsRules(unittest.TestCase):
def test_qradar_analytics_rules_merged(self, connection):
self._plugin.search_for_resource = MagicMock()
self._plugin.search_for_resource.return_value = RESPONSE_PAYLOAD
- self._plugin._connection.socket_path = (
- tempfile.NamedTemporaryFile().name
- )
+ self._plugin._connection.socket_path = tempfile.NamedTemporaryFile().name
self._plugin._connection._shell = MagicMock()
self._plugin._task.args = {
"state": "merged",
@@ -96,9 +93,7 @@ class TestQradarAnalyticsRules(unittest.TestCase):
@patch("ansible.module_utils.connection.Connection.__rpc__")
def test_qradar_analytics_rules_merged_idempotent(self, connection):
- self._plugin._connection.socket_path = (
- tempfile.NamedTemporaryFile().name
- )
+ self._plugin._connection.socket_path = tempfile.NamedTemporaryFile().name
self._plugin._connection._shell = MagicMock()
self._plugin.search_for_resource = MagicMock()
self._plugin.search_for_resource.return_value = RESPONSE_PAYLOAD
@@ -115,9 +110,7 @@ class TestQradarAnalyticsRules(unittest.TestCase):
@patch("ansible.module_utils.connection.Connection.__rpc__")
def test_qradar_analytics_rules_deleted(self, connection):
- self._plugin._connection.socket_path = (
- tempfile.NamedTemporaryFile().name
- )
+ self._plugin._connection.socket_path = tempfile.NamedTemporaryFile().name
self._plugin._connection._shell = MagicMock()
self._plugin.search_for_resource = MagicMock()
self._plugin.search_for_resource.return_value = RESPONSE_PAYLOAD
@@ -135,9 +128,7 @@ class TestQradarAnalyticsRules(unittest.TestCase):
def test_qradar_analytics_rules_deleted_idempotent(self, connection):
self._plugin.search_for_resource = MagicMock()
self._plugin.search_for_resource.return_value = {}
- self._plugin._connection.socket_path = (
- tempfile.NamedTemporaryFile().name
- )
+ self._plugin._connection.socket_path = tempfile.NamedTemporaryFile().name
self._plugin._connection._shell = MagicMock()
self._plugin._task.args = {
"state": "deleted",
@@ -150,9 +141,7 @@ class TestQradarAnalyticsRules(unittest.TestCase):
@patch("ansible.module_utils.connection.Connection.__rpc__")
def test_qradar_analytics_rules_gathered(self, connection):
- self._plugin._connection.socket_path = (
- tempfile.NamedTemporaryFile().name
- )
+ self._plugin._connection.socket_path = tempfile.NamedTemporaryFile().name
self._plugin._connection._shell = MagicMock()
self._plugin.search_for_resource = MagicMock()
self._plugin.search_for_resource.return_value = RESPONSE_PAYLOAD
diff --git a/ansible_collections/ibm/qradar/tests/unit/plugins/modules/conftest.py b/ansible_collections/ibm/qradar/tests/unit/plugins/modules/conftest.py
index e19a1e04c..349e71ada 100644
--- a/ansible_collections/ibm/qradar/tests/unit/plugins/modules/conftest.py
+++ b/ansible_collections/ibm/qradar/tests/unit/plugins/modules/conftest.py
@@ -2,15 +2,16 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
import json
import pytest
-from ansible.module_utils.six import string_types
from ansible.module_utils._text import to_bytes
from ansible.module_utils.common._collections_compat import MutableMapping
+from ansible.module_utils.six import string_types
@pytest.fixture
@@ -21,20 +22,13 @@ def patch_ansible_module(request, mocker):
if "ANSIBLE_MODULE_ARGS" not in request.param:
request.param = {"ANSIBLE_MODULE_ARGS": request.param}
if "_ansible_remote_tmp" not in request.param["ANSIBLE_MODULE_ARGS"]:
- request.param["ANSIBLE_MODULE_ARGS"][
- "_ansible_remote_tmp"
- ] = "/tmp"
- if (
- "_ansible_keep_remote_files"
- not in request.param["ANSIBLE_MODULE_ARGS"]
- ):
- request.param["ANSIBLE_MODULE_ARGS"][
- "_ansible_keep_remote_files"
- ] = False
+ request.param["ANSIBLE_MODULE_ARGS"]["_ansible_remote_tmp"] = "/tmp"
+ if "_ansible_keep_remote_files" not in request.param["ANSIBLE_MODULE_ARGS"]:
+ request.param["ANSIBLE_MODULE_ARGS"]["_ansible_keep_remote_files"] = False
args = json.dumps(request.param)
else:
raise Exception(
- "Malformed data to the patch_ansible_module pytest fixture"
+ "Malformed data to the patch_ansible_module pytest fixture",
)
mocker.patch("ansible.module_utils.basic._ANSIBLE_ARGS", to_bytes(args))
diff --git a/ansible_collections/ibm/qradar/tests/unit/plugins/modules/utils.py b/ansible_collections/ibm/qradar/tests/unit/plugins/modules/utils.py
index d55afc0b3..e86add0b3 100644
--- a/ansible_collections/ibm/qradar/tests/unit/plugins/modules/utils.py
+++ b/ansible_collections/ibm/qradar/tests/unit/plugins/modules/utils.py
@@ -1,12 +1,13 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
import json
-from ansible_collections.trendmicro.deepsec.tests.unit.compat import unittest
-from ansible_collections.trendmicro.deepsec.tests.unit.compat.mock import patch
from ansible.module_utils import basic
from ansible.module_utils._text import to_bytes
+from ansible_collections.trendmicro.deepsec.tests.unit.compat import unittest
+from ansible_collections.trendmicro.deepsec.tests.unit.compat.mock import patch
def set_module_args(args):
@@ -41,7 +42,9 @@ def fail_json(*args, **kwargs):
class ModuleTestCase(unittest.TestCase):
def setUp(self):
self.mock_module = patch.multiple(
- basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json
+ basic.AnsibleModule,
+ exit_json=exit_json,
+ fail_json=fail_json,
)
self.mock_module.start()
self.mock_sleep = patch("time.sleep")