Private
Public Access
1
0

more coverage

This commit is contained in:
Sander Roosendaal
2021-04-26 18:26:16 +02:00
parent 9e2a97e721
commit 594ee6239a
11 changed files with 133 additions and 91 deletions

View File

@@ -78,7 +78,7 @@ def get_token(code):
thetoken = token_json['access_token']
expires_in = token_json['expires_in']
refresh_token = token_json['refresh_token']
except KeyError:
except KeyError: # pragma: no cover
thetoken = 0
expires_in = 0
refresh_token = 0
@@ -86,11 +86,11 @@ def get_token(code):
return thetoken,expires_in,refresh_token
# Make authorization URL including random string
def make_authorization_url(request):
def make_authorization_url(request): # pragma: no cover
return imports_make_authorization_url(oauth_data)
def getidfromresponse(response):
def getidfromresponse(response): # pragma: no cover
t = json.loads(response.text)
links = t["_links"]
@@ -113,7 +113,7 @@ def createtpworkoutdata(w):
return tcxfilename
def tp_check(access_token):
def tp_check(access_token): # pragma: no cover
headers = {
"Content-Type": "application/json",
'Accept': 'application/json',
@@ -157,15 +157,15 @@ def uploadactivity(access_token,filename,description='',
data = json.dumps(data),
headers=headers,verify=False)
if resp.status_code != 200:
if resp.status_code != 200: # pragma: no cover
return 0,resp.reason,resp.status_code,headers
else:
return resp.json()[0]["Id"],"ok",200,""
return 0,0,0,0
return 0,0,0,0 # pragma: no cover
def workout_tp_upload(user,w):
def workout_tp_upload(user,w): # pragma: no cover
message = "Uploading to TrainingPeaks"
tpid = 0
r = w.user