mirror of
https://github.com/izzy2lost/docker-android.git
synced 2026-06-19 01:16:28 -07:00
Fixed installation bug
This commit is contained in:
+3
-3
@@ -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()
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user