mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-23 20:44:00 -07:00
django_dumpdata, django_loaddata: new modules (#10726)
Some checks failed
EOL CI / EOL Sanity (Ⓐ2.16) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.16+py2.7) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.16+py3.11) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.16+py3.6) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/3/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/3/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/3/) (push) Has been cancelled
nox / Run extra sanity tests (push) Has been cancelled
Some checks failed
EOL CI / EOL Sanity (Ⓐ2.16) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.16+py2.7) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.16+py3.11) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.16+py3.6) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/3/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/3/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/3/) (push) Has been cancelled
nox / Run extra sanity tests (push) Has been cancelled
* django module, module_utils: adjustments * more fixes * more fixes * further simplification * django_dumpdata/django_loaddata: new modules * Update plugins/modules/django_dumpdata.py Co-authored-by: Felix Fontein <felix@fontein.de> * add note about idempotency --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
aed763dae7
commit
d0123a1038
9 changed files with 364 additions and 4 deletions
13
tests/unit/plugins/modules/test_django_dumpdata.py
Normal file
13
tests/unit/plugins/modules/test_django_dumpdata.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Copyright (c) Alexei Znamensky (russoz@gmail.com)
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import django_dumpdata
|
||||
from .uthelper import UTHelper, RunCommandMock
|
||||
|
||||
|
||||
UTHelper.from_module(django_dumpdata, __name__, mocks=[RunCommandMock])
|
||||
36
tests/unit/plugins/modules/test_django_dumpdata.yaml
Normal file
36
tests/unit/plugins/modules/test_django_dumpdata.yaml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) Alexei Znamensky (russoz@gmail.com)
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
---
|
||||
anchors:
|
||||
environ: &env-def {environ_update: {LANGUAGE: C, LC_ALL: C}, check_rc: true}
|
||||
test_cases:
|
||||
- id: command_success
|
||||
input:
|
||||
settings: whatever.settings
|
||||
fixture: /tmp/mydata.json
|
||||
mocks:
|
||||
run_command:
|
||||
- command: [/testbin/python, -m, django, --version]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "5.1.2\n"
|
||||
err: ''
|
||||
- command:
|
||||
- /testbin/python
|
||||
- -m
|
||||
- django
|
||||
- dumpdata
|
||||
- --no-color
|
||||
- --settings=whatever.settings
|
||||
- --format
|
||||
- json
|
||||
- --database=default
|
||||
- --output
|
||||
- /tmp/mydata.json
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "whatever\n"
|
||||
err: ''
|
||||
13
tests/unit/plugins/modules/test_django_loaddata.py
Normal file
13
tests/unit/plugins/modules/test_django_loaddata.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Copyright (c) Alexei Znamensky (russoz@gmail.com)
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import django_loaddata
|
||||
from .uthelper import UTHelper, RunCommandMock
|
||||
|
||||
|
||||
UTHelper.from_module(django_loaddata, __name__, mocks=[RunCommandMock])
|
||||
35
tests/unit/plugins/modules/test_django_loaddata.yaml
Normal file
35
tests/unit/plugins/modules/test_django_loaddata.yaml
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) Alexei Znamensky (russoz@gmail.com)
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
---
|
||||
anchors:
|
||||
environ: &env-def {environ_update: {LANGUAGE: C, LC_ALL: C}, check_rc: true}
|
||||
test_cases:
|
||||
- id: command_success
|
||||
input:
|
||||
settings: whatever.settings
|
||||
fixtures: /tmp/mydata.json
|
||||
mocks:
|
||||
run_command:
|
||||
- command: [/testbin/python, -m, django, --version]
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "5.1.2\n"
|
||||
err: ''
|
||||
- command:
|
||||
- /testbin/python
|
||||
- -m
|
||||
- django
|
||||
- loaddata
|
||||
- --no-color
|
||||
- --settings=whatever.settings
|
||||
- --database=default
|
||||
- --format
|
||||
- json
|
||||
- /tmp/mydata.json
|
||||
environ: *env-def
|
||||
rc: 0
|
||||
out: "whatever\n"
|
||||
err: ''
|
||||
Loading…
Add table
Add a link
Reference in a new issue