fixing tests
This commit is contained in:
@@ -23,6 +23,15 @@ from json.decoder import JSONDecodeError
|
||||
|
||||
from pytz.exceptions import UnknownTimeZoneError
|
||||
|
||||
def dologging(s):
|
||||
tstamp = time.localtime()
|
||||
timestamp = time.strftime('%b-%d-%Y %H:%M:%S', tstamp)
|
||||
with open('debuglog.log','a') as f:
|
||||
f.write('\n')
|
||||
f.write(timestamp)
|
||||
f.write(' ')
|
||||
f.write(s)
|
||||
|
||||
from rowsandall_app.settings import (
|
||||
C2_CLIENT_ID, C2_REDIRECT_URI, C2_CLIENT_SECRET,
|
||||
UPLOAD_SERVICE_URL, UPLOAD_SERVICE_SECRET
|
||||
@@ -695,7 +704,7 @@ def createc2workoutdata(w):
|
||||
workouttype = 'water'
|
||||
|
||||
|
||||
wendtime = w.startdatetime-datetime.timedelta(seconds=makeseconds(durationstr))
|
||||
wendtime = w.startdatetime+datetime.timedelta(seconds=makeseconds(durationstr))
|
||||
|
||||
data = {
|
||||
"type": mytypes.c2mapping[workouttype],
|
||||
@@ -1018,7 +1027,9 @@ def workout_c2_upload(user,w,asynchron=False):
|
||||
if not c2userid: # pragma: no cover
|
||||
raise NoTokenError("User has no token")
|
||||
|
||||
dologging('Upload to C2 user {userid}'.format(userid=user.id))
|
||||
data = createc2workoutdata(w)
|
||||
dologging(json.dumps(data))
|
||||
|
||||
if data == 0: # pragma: no cover
|
||||
return "Error: No data file. Contact info@rowsandall.com if the problem persists",0
|
||||
|
||||
Reference in New Issue
Block a user