diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..b599fdc --- /dev/null +++ b/gating.yaml @@ -0,0 +1,7 @@ +# recipients: abokovoy, frenaud, kaleem, ftrivino, cheimes +--- !Policy +product_versions: + - rhel-9 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional} diff --git a/tests/sanity.sh b/tests/sanity.sh new file mode 100644 index 0000000..4136d8d --- /dev/null +++ b/tests/sanity.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -ex + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +dnf install -y python3-qrcode + +exec ${DIR}/test_ipa_otptoken.py diff --git a/tests/test_ipa_otptoken.py b/tests/test_ipa_otptoken.py new file mode 100644 index 0000000..0c9e0b4 --- /dev/null +++ b/tests/test_ipa_otptoken.py @@ -0,0 +1,30 @@ +#!/usr/libexec/platform-python +"""Simple test for APIs used by python3-qrcode +""" +import io +import logging +import hashlib + +import qrcode + +logging.basicConfig(level=logging.INFO) +log = logging.getLogger() + +TEXT = "example data" +HASH = "4d0186bad6cb0ea83f634959bba9bd2494f2b15cc785285e0914521246452e06" + + +def main(): + qr_output = io.StringIO() + qr = qrcode.QRCode() + qr.add_data(TEXT) + qr.make() + qr.print_ascii(out=qr_output, tty=False) + value = qr_output.getvalue() + print(value) + assert hashlib.sha256(value.encode('utf-8')).hexdigest() == HASH + log.info("PASS") + + +if __name__ == "__main__": + main() diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..6bf64e7 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,10 @@ +--- +- hosts: localhost + tags: + - classic + roles: + - role: standard-test-scripts + tests: + - sanity.sh + files: + - test_ipa_otptoken.py