From 85bdbbecac9484b0f7b365efd23bb1d434a803df Mon Sep 17 00:00:00 2001 From: Sudhir Menon Date: Wed, 26 Jun 2024 16:05:54 +0530 Subject: [PATCH] Added gating.yaml and test for python-yubico Signed-off-by: Sudhir Menon --- gating.yaml | 7 +++++++ tests/test_ipa_yubikey.py | 28 ++++++++++++++++++++++++++++ tests/tests.yml | 14 ++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 gating.yaml create mode 100644 tests/test_ipa_yubikey.py create mode 100644 tests/tests.yml diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..122483d --- /dev/null +++ b/gating.yaml @@ -0,0 +1,7 @@ +# recipients: abokovoy, frenaud, kaleem, ftrivino, cheimes +--- !Policy +product_versions: + - rhel-10 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/tests/test_ipa_yubikey.py b/tests/test_ipa_yubikey.py new file mode 100644 index 0000000..e97562d --- /dev/null +++ b/tests/test_ipa_yubikey.py @@ -0,0 +1,28 @@ +#!/usr/bin/python3 +"""Simple test for APIs used by IPA's otptoken plugin +""" +import logging + +import yubico +import usb.core + +logging.basicConfig(level=logging.INFO) +log = logging.getLogger() + + +def main(): + try: + yk = yubico.find_yubikey() + except usb.core.USBError as e: + log.info(e) + except yubico.yubikey.YubiKeyError as e: + log.info(e) + else: + assert yk.version_num() + log.info(yk.status()) + log.info(yk.status().valid_configs()) + log.info("PASS") + + +if __name__ == "__main__": + main() diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..4411765 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,14 @@ +--- +- hosts: localhost + tags: + - classic + roles: + - role: standard-test-source + - role: standard-test-basic + required_packages: + - python3-yubico + tests: + - test_ipa_yubikey: + dir: "tests" + run: ./test_ipa_yubikey.py +