Fixed installation bug

This commit is contained in:
butomo1989 2017-03-17 12:41:28 +01:00
parent 135c3e32f1
commit 26b99bd32b
2 changed files with 4 additions and 4 deletions

View file

@ -37,8 +37,7 @@ def get_item_position(keyword, items):
pos = 0
for p, v in enumerate(items):
if keyword in v:
pos = p
break # Get the first item that match with keyword
pos = p # Get the last item that match with keyword
return pos
@ -58,8 +57,9 @@ def get_api_level(android_version):
if packages:
item_pos = get_item_position(android_version, packages)
logger.info('package in position: {pos}'.format(pos=item_pos))
logger.info('Package in position: {pos}'.format(pos=item_pos))
item = packages[item_pos]
logger.info('Item: {item}'.format(item=item))
item_info = item.split('-')
api_version = re.search('%s(.*)%s' % ('API', ','), item_info[1]).group(1).strip()

View file

@ -13,7 +13,7 @@ class TestItemPosition(TestCase):
def test_valid_params(self):
keyword = '4.2'
output = android.get_item_position(keyword, self.items)
self.assertEqual(1, output)
self.assertEqual(4, output)
def test_invalid_keyword(self):
keyword = 'fake'