Resolves: RHELMISC-5984 require ibus-typing-booster instead of emoji-picker, rewrite test to better show when something goes wrong
This commit is contained in:
parent
1b213a929f
commit
b684bff04b
@ -1,5 +1,5 @@
|
||||
require:
|
||||
- appstream
|
||||
- emoji-picker
|
||||
- ibus-typing-booster
|
||||
test: python3 test_appstream.py -v
|
||||
framework: shell
|
||||
|
||||
@ -13,34 +13,54 @@ class TestAppstream(unittest.TestCase):
|
||||
|
||||
def test_appstreamcli_search(self):
|
||||
cp = subprocess.run(
|
||||
['env LC_ALL=en_US.UTF-8 appstreamcli search emoji-picker'],
|
||||
['env LC_ALL=en_US.UTF-8 appstreamcli search ibus-typing-booster'],
|
||||
encoding='UTF-8',
|
||||
text=True,
|
||||
shell=True,
|
||||
capture_output=True)
|
||||
print('----------------------------------------')
|
||||
print(cp.stdout)
|
||||
print('----------------------------------------')
|
||||
output_lines = cp.stdout.split('\n')
|
||||
result_dict = {}
|
||||
identifier = ''
|
||||
for line in output_lines:
|
||||
if line == '---' or ':' not in line:
|
||||
continue
|
||||
key, value = map(str.strip, line.split(':', maxsplit=1))
|
||||
if key == 'Identifier':
|
||||
identifier = value
|
||||
result_dict[identifier] = {}
|
||||
result_dict[identifier][key] = value
|
||||
print('----------------------------------------')
|
||||
print(output_lines)
|
||||
print(result_dict)
|
||||
print('----------------------------------------')
|
||||
typing_booster_identifier = (
|
||||
'org.freedesktop.ibus.engine.typing_booster [inputmethod]')
|
||||
print(f'Assert that {typing_booster_identifier} in {result_dict.keys()}')
|
||||
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: org.freedesktop.ibus.engine.typing_booster.emoji_picker.png'
|
||||
in output_lines)
|
||||
# This section not always there, better don’t test for this:
|
||||
# self.assertTrue(
|
||||
# 'Package: emoji-picker'
|
||||
# in output_lines)
|
||||
typing_booster_identifier
|
||||
in result_dict.keys())
|
||||
expected_dict = {
|
||||
typing_booster_identifier: {
|
||||
'Identifier': typing_booster_identifier,
|
||||
'Name': 'Typing Booster',
|
||||
'Summary': 'Predictive input method',
|
||||
# The 'Package' section seems to be not always there,
|
||||
# better do not test for this:
|
||||
# 'Package': 'ibus-typing-booster',
|
||||
'Homepage': 'https://mike-fabian.github.io/ibus-typing-booster/',
|
||||
'Icon': 'org.freedesktop.ibus.engine.typing_booster.png',
|
||||
}
|
||||
}
|
||||
for result_key, result_value in result_dict.items():
|
||||
if result_key == typing_booster_identifier:
|
||||
for expected_key, expected_value in (
|
||||
expected_dict[typing_booster_identifier].items()):
|
||||
print(f'Assert that {expected_key} is {expected_value}:')
|
||||
self.assertEqual(
|
||||
result_dict[result_key][expected_key],
|
||||
expected_value)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user