Commit graph

15 commits

Author SHA1 Message Date
patchback[bot]
e3dae0b646
[PR #9736/8e324881 backport][stable-10] rename test helper (#9745)
rename test helper (#9736)

* rename test helper

* update ignore lines

(cherry picked from commit 8e324881a6)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2025-02-15 08:25:27 +01:00
patchback[bot]
6e48528b22
[PR #9675/4a31c753 backport][stable-10] test helper: remove magically finding the testcasemock in the test module (#9677)
test helper: remove magically finding the testcasemock in the test module (#9675)

(cherry picked from commit 4a31c753e7)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2025-02-03 07:03:39 +01:00
patchback[bot]
f545c300d9
[PR #9672/7a6125b9 backport][stable-10] test helper: improvements (#9673)
test helper: improvements (#9672)

(cherry picked from commit 7a6125b99a)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2025-02-02 10:50:11 +01:00
patchback[bot]
c35f13084d
[PR #9666/c0f57b5c backport][stable-10] test helper: add support for check and diff modes (#9669)
test helper: add support for check and diff modes (#9666)

(cherry picked from commit c0f57b5c62)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2025-02-01 18:49:35 +01:00
patchback[bot]
7e4a39964e
[PR #9662/4d384bd7 backport][stable-10] test helper: fix parameter passing in creation static method (#9663)
test helper: fix parameter passing in creation static method (#9662)

(cherry picked from commit 4d384bd74a)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2025-02-01 15:01:57 +01:00
patchback[bot]
a89990ab9b
[PR #9242/88ea025d backport][stable-10] test helper improvements (#9247)
test helper improvements (#9242)

(cherry picked from commit 88ea025d12)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2024-12-14 10:44:16 +01:00
Alexei Znamensky
8ef77d8664
unit test helper: big revamp (#8894)
* initial commit

* multiple changes:

- TestCaseContext fixture no longer need to autouse=True
- Helper.from_module() allows extra param to specify yaml file
- test_django_check: adjusted .py and .yaml

* set fixtures per testcase

* set fixtures per testcase

* rollback to original state

* patch_ansible_module fixture

- now it works not only in parametrized functions but also directly with args

* tests/unit/plugins/modules/helper.py

- improved encapsulation, class Helper no longer knows details about test cases
- test functions no longer parametrized, that allows using test case fixtures per test function
- renamed 'context' to 'mock'

* enable Helper.from_list(), better param name 'ansible_module'

* adjusted test fiels to new helper

* remove unnecessary .license file

* fix bracket

* fix reference name

* Update tests/unit/plugins/modules/helper.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* revert to parametrized test func instead of multiple funcs

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
2024-09-28 08:17:36 +03:00
Alexei Znamensky
da2c87ce0d
fix test helper handling of rc (#8387)
* fix test helper handling of rc

* fix side_effect logic for rc != 0

* fix side_effect func + sanity tests

* fix ignore files

* fix code

* revamp the generator for run_command calls returns in testcase

* remove unused import

* Update tests/sanity/ignore-2.18.txt

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update tests/sanity/ignore-2.17.txt

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
2024-05-24 21:59:00 +02:00
Alexei Znamensky
1ac94b5f44
Initial commit for django modutils and django_command module (#8349)
* Initial commit for django modutils and django_command module

* Fixed sanity, param settings required

* add stdout, stderr and cmd to django module output

* add examples and return docs to djando_command module

* multiple minor adjustments

* fix typo

* Update plugins/modules/django_command.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/django_command.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/django_command.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* move note to seealso

* add xfailing test

* Update plugins/doc_fragments/django.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/doc_fragments/django.py

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
2024-05-15 18:51:42 +02:00
Alexei Znamensky
9b16392648
test helper: Helper.from_module() injects test function into test module (#7560) 2023-11-20 23:23:16 +13:00
Alexei Znamensky
3b87f58070
Test helper more (#7421)
* facter: add option to return facts instead of output variables

* Update plugins/modules/facter.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* add output doc

* add changelog frag

* reversed facter.py, created facter_facts.py

* remove chglog fragment for new module

* test helper: add Helper.from_module()

* change case in variable name

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
2023-10-23 23:04:18 +02:00
Alexei Znamensky
9489a1ea1c
New Module: gio_mime (#7271)
* gio_mime: new module

* multiple changes

- fixed gio_mime module utils handler detection
- add message to test helper assertion
- add unit test

* gio mime output uses unicode smart quotes

* test helper: do not use skip/xfail reason messages - break in old pytest

* Update plugins/modules/gio_mime.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* change exist variables to meet standards

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
2023-09-20 19:29:05 +02:00
Alexei Znamensky
e7ff0acdac
refactor test helper context class (#7266) 2023-09-15 21:36:59 +12:00
Alexei Znamensky
6e3a56ffce
encapsulate test function in the helper class (#7247) 2023-09-13 00:24:10 +12:00
Alexei Znamensky
bdf8852e8d
test helper: create static methods .from_file() and .from_list() (#7239)
create static methods .from_file() and .from_list()
2023-09-12 06:42:33 +02:00
Renamed from tests/unit/plugins/modules/cmd_runner_test_utils.py (Browse further)