From 680fb4929a076c1c0c30175d924d50b8de4d926f Mon Sep 17 00:00:00 2001 From: Mike FABIAN Date: Tue, 6 Jul 2021 11:56:52 +0200 Subject: [PATCH] Resolves: rhbz#1979528 Add CI tests and gating.yaml --- .fmf/version | 1 + gating.yaml | 6 ++++++ plans/basic.fmf | 9 ++++++++ tests/main.fmf | 5 +++++ tests/test_appstream.py | 46 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 67 insertions(+) create mode 100644 .fmf/version create mode 100644 gating.yaml create mode 100644 plans/basic.fmf create mode 100644 tests/main.fmf create mode 100644 tests/test_appstream.py diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..648918d --- /dev/null +++ b/gating.yaml @@ -0,0 +1,6 @@ +--- !Policy +product_versions: + - rhel-9 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/plans/basic.fmf b/plans/basic.fmf new file mode 100644 index 0000000..574bc78 --- /dev/null +++ b/plans/basic.fmf @@ -0,0 +1,9 @@ +summary: Basic smoke test +discover: + how: fmf +execute: + how: tmt +prepare: + how: shell + script: + - dnf config-manager --enable rhel-CRB --enable rhel-buildroot diff --git a/tests/main.fmf b/tests/main.fmf new file mode 100644 index 0000000..dce9b1e --- /dev/null +++ b/tests/main.fmf @@ -0,0 +1,5 @@ +require: +- appstream +- emoji-picker +test: python3 test_appstream.py -v +framework: shell diff --git a/tests/test_appstream.py b/tests/test_appstream.py new file mode 100644 index 0000000..e03e85e --- /dev/null +++ b/tests/test_appstream.py @@ -0,0 +1,46 @@ +import unittest +import sys +import subprocess + +class TestAppstream(unittest.TestCase): + + def test_dummy(self): + self.assertEqual(True, True) + + @unittest.expectedFailure + def test_expected_failure(self): + self.assertEqual(False, True) + + def test_appstreamcli_search(self): + cp = subprocess.run( + ['env LC_ALL=en_US.UTF-8 appstreamcli search emoji-picker'], + encoding='UTF-8', + text=True, + shell=True, + capture_output=True) + output_lines = cp.stdout.split('\n') + print('----------------------------------------') + print(output_lines) + print('----------------------------------------') + self.assertTrue( + 'Identifier: org.freedesktop.ibus.engine.typing_booster.emoji_picker [desktop-application]' + in output_lines) + self.assertTrue( + 'Name: Emoji Picker' + in output_lines) + self.assertTrue( + 'Summary: Emoji browsing tool' + in output_lines) + self.assertTrue( + 'Homepage: https://mike-fabian.github.io/ibus-typing-booster/' + in output_lines) + self.assertTrue( + 'Icon: ibus-typing-booster.png' + in output_lines) + # This section not always there, better don’t test for thi + # self.assertTrue( + # 'Package: emoji-picker' + # in output_lines) + +if __name__ == "__main__": + unittest.main()