common.get_app_display_name() for finding app names

This commit is contained in:
Hans-Christoph Steiner 2020-11-17 23:49:04 +01:00
parent c7fcfe3bfa
commit 0f6b638986
6 changed files with 44 additions and 11 deletions

View file

@ -1612,6 +1612,21 @@ class CommonTest(unittest.TestCase):
self.assertEqual([dirtyfile, 'repo/status/running.json'],
data['fdroiddata']['untrackedFiles'])
def test_get_app_display_name(self):
testvalue = 'WIN!'
for app in [
{'Name': testvalue},
{'AutoName': testvalue},
{'id': testvalue},
{'id': 'a', 'localized': {'de-AT': {'name': testvalue}}},
{'id': 'a', 'localized': {
'de-AT': {'name': 'nope'},
'en-US': {'name': testvalue},
}},
{'AutoName': 'ignore me', 'Name': testvalue, 'id': 'nope'},
{'AutoName': testvalue, 'id': 'nope'}]:
self.assertEqual(testvalue, fdroidserver.common.get_app_display_name(app))
if __name__ == "__main__":
os.chdir(os.path.dirname(__file__))