1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-02-04 07:51:50 +00:00
community.general/tests/unit/plugins/modules/test_krb_ticket.yaml
Felix Fontein 8f8a0e1d7c
Fix __future__ imports, __metaclass__ = type, and remove explicit UTF-8 encoding statement for Python files (#10886)
* Adjust all __future__ imports:

for i in $(grep -REl "__future__.*absolute_import" plugins/ tests/); do
  sed -e 's/from __future__ import .*/from __future__ import annotations/g' -i $i;
done

* Remove all UTF-8 encoding specifications for Python source files:

for i in $(grep -REl '[-][*]- coding: utf-8 -[*]-' plugins/ tests/); do
  sed -e '/^# -\*- coding: utf-8 -\*-/d' -i $i;
done

* Remove __metaclass__ = type:

for i in $(grep -REl '__metaclass__ = type' plugins/ tests/); do
  sed -e '/^__metaclass__ = type/d' -i $i;
done
2025-10-10 19:52:04 +02:00

113 lines
2.8 KiB
YAML

# 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: false}
environ_data: &env-data {environ_update: {LANGUAGE: C, LC_ALL: C}, check_rc: true, data: cool_password}
environ_norc: &env-norc {environ_update: {LANGUAGE: C, LC_ALL: C}, check_rc: true}
test_cases:
- id: test_kinit_default
input:
state: present
password: cool_password
output:
changed: true
mocks:
run_command:
- command: [/testbin/klist]
environ: *env-def
rc: 1
out: ''
err: ''
- command: [/testbin/kinit]
environ: *env-data
rc: 0
out: ''
err: ''
- id: test_kinit_principal
input:
state: present
password: cool_password
principal: admin@IPA.TEST
output:
changed: true
mocks:
run_command:
- command: [/testbin/klist, -l]
environ: *env-def
rc: 0
out: ''
err: ''
- command: [/testbin/kinit, admin@IPA.TEST]
environ: *env-data
rc: 0
out: ''
err: ''
- id: test_kdestroy_default
input:
state: absent
output:
changed: true
mocks:
run_command:
- command: [/testbin/klist]
environ: *env-def
rc: 0
out: ''
err: ''
- command: [/testbin/kdestroy]
environ: *env-norc
rc: 0
out: ''
err: ''
- id: test_kdestroy_principal
input:
state: absent
principal: admin@IPA.TEST
output:
changed: true
mocks:
run_command:
- command: [/testbin/klist, -l]
environ: *env-def
rc: 0
out: admin@IPA.TEST
err: ''
- command: [/testbin/kdestroy, -p, admin@IPA.TEST]
environ: *env-norc
rc: 0
out: ''
err: ''
- id: test_kdestroy_cache_name
input:
state: absent
cache_name: KEYRING:persistent:0:0
output:
changed: true
mocks:
run_command:
- command: [/testbin/klist, -l]
environ: *env-def
rc: 0
out: KEYRING:persistent:0:0
err: ''
- command: [/testbin/kdestroy, -c, KEYRING:persistent:0:0]
environ: *env-norc
rc: 0
out: ''
err: ''
- id: test_kdestroy_all
input:
state: absent
kdestroy_all: true
output:
changed: true
mocks:
run_command:
- command: [/testbin/kdestroy, -A]
environ: *env-norc
rc: 0
out: ''
err: ''