idm/tests/python-yubico/test_ipa_yubikey.py
2023-02-23 11:47:58 +00:00

29 lines
559 B
Python
Executable File

#!/usr/libexec/platform-python
"""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()