1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/tests/unit/plugins/modules
Alexei Znamensky e3fcc7de2a
Adding module_utils/module_helper.py + big revamp in xfconf.py to use it (#1322)
* Big revamp in xfconf.py

- added plugin/module_utils/module_helper.py
  - scaffold class for writing modules, beyond standard AnsibleModule
  - automatic capture of exceptions
  - easier dependency testing
  - StateMixin to easily handle different behaviours for 'state' param
  - CmdMixin to easily run external commands
- adapted test_xfconf.py
  - the args for run_command are now lists instead of a string
  - value and previous_value were not being tested before (because xfconf wasn't filling results - see below)
  - added more tests: setting value to previous_value, getting non-existent property
- rewritten xfconf module, keeping the same results
  - original module posted results as ansible_facts, this version still does it for compatibility, but also adds to the module result

* Added suggestions from the PR

* Added russoz as maintainer for the module_utils/module_helper.py file

* Formatting using printf-style requires special treatment

Strings not containing substitution tokens must work as well.

* Tidied up variables in module definition

* Tests with ArgFormat and DependencyCtxMgr

* pytest parameters must be in the same order, it seems

* improved testing for the DependencyCtxMgr

* fixed test for older pythons

* Moved changed property to improve readability

* Added testcase for state: absent and adjusted xfconf after it

* Fixed param name environ_update in run_command()

* added changelog fragment

* fixed tests after run_command param change
2020-11-20 11:27:53 +01:00
..
cloud kubevirt: Re-enable unit tests (#1070) 2020-10-12 07:38:33 +02:00
database postgresql_ext: fix module's failing when available ext versions contain a pure string (#1099) 2020-10-16 11:56:15 +03:00
messaging Move modules and module_utils unit tests to correct place (#81) 2020-03-31 10:42:38 +02:00
monitoring Adds a module for sending PagerDuty change events. (#1269) 2020-11-13 11:44:57 +03:00
net_tools Add hetzner_failover_ip* tests (#1301) 2020-11-16 07:50:56 +01:00
notification move conversion of data to json in slack API handling (#1101) 2020-10-19 10:58:14 +03:00
packaging Resolve homebrew and homebrew_cask package name validation issues (#1038) 2020-10-27 22:46:49 +01:00
remote_management sanity: Add future boilerplate (#573) 2020-06-24 21:50:36 +02:00
source_control added description parameter to create request (#1196) 2020-11-11 13:33:38 +01:00
storage sanity: Add future boilerplate (#573) 2020-06-24 21:50:36 +02:00
system Adding module_utils/module_helper.py + big revamp in xfconf.py to use it (#1322) 2020-11-20 11:27:53 +01:00
web_infrastructure sanity: Add future boilerplate (#573) 2020-06-24 21:50:36 +02:00
__init__.py Move modules and module_utils unit tests to correct place (#81) 2020-03-31 10:42:38 +02:00
conftest.py sanity: Add future boilerplate (#573) 2020-06-24 21:50:36 +02:00
utils.py sanity: Add future boilerplate (#573) 2020-06-24 21:50:36 +02:00