Skip to content

Commit

Permalink
test.py: fixed wrong method + added progressbar
Browse files Browse the repository at this point in the history
Signed-off-by: Domenico Iezzi <[email protected]>
  • Loading branch information
Domenico Iezzi committed Oct 7, 2017
1 parent 73906b1 commit cb2dc79
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
version = apps[0]['versionCode']
print('\nTermux docid is: %s\n' % docid)
print('\nAttempting to download %s\n' % docid)
fl = server.download(docid, version)
fl = server.download(docid, version, progress_bar=True)
with open(docid + '.apk', 'wb') as f:
f.write(fl)
print('\nDownload successful\n')
Expand All @@ -46,18 +46,20 @@
# Attempting to download Nova Launcher Prime
# it should throw an error 'App Not Purchased'

print('\nAttempting to download "com.teslacoilsw.launcher.prime"\n')
errorThrown = False
try:
app = server.search('nova launcher prime', 3, None)
app = filter(lambda x: x['docId'] == 'com.teslacoilsw.launcher.prime', app)
app = list(app)[0]
fl = server.download(app['docId'], app['versionCode'])
fl = server.delivery(app['docId'], app['versionCode'], progress_bar=True)
with open(docid + '.apk', 'wb') as f:
f.write(fl)
print('\nDownload successful\n')
f.close()
except RequestError as e:
errorThrown = True
print(e)

if not errorThrown:
print('Download of previous app should have failed')
Expand Down

0 comments on commit cb2dc79

Please sign in to comment.