Private
Public Access
1
0

adding a few more tests - coverage

This commit is contained in:
Sander Roosendaal
2021-11-04 19:41:11 +01:00
parent 4a772ed409
commit be5178c155
3 changed files with 59 additions and 9 deletions

View File

@@ -348,18 +348,25 @@ def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,descrip
try:
act = client.update_activity(res.id,activity_type=activity_type,
description=description,device_name='Rowsandall.com')
dologging('stravalog.log','Updating activity {id} to {type}'.format(
id=workoutid,
type=activity_type
))
except TypeError: # pragma: no cover
act = client.update_activity(res.id,activity_type=activity_type,
description=description)
dologging('stravalog.log','Updating activity {id} to {type}'.format(
id=workoutid,
type=activity_type
))
except: # pragma: no cover
e = sys.exc_info()[0]
t = time.localtime()
timestamp = bytes('{t}'.format(t=time.strftime('%b-%d-%Y_%H%M', t)),'utf-8')
with open('stravalog.log','ab') as f:
f.write(b'\n')
f.write(timestamp)
f.write(str(e))
dologging('stravalog.log','Update activity failed with error {e} for {id} to {type}'.format(
id=workoutid,
type=activity_type,
e=e
))
try:
os.remove(filename)
except: # pragma: no cover