Merge branch 'develop' into feature/testcoverage
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -188,6 +188,7 @@ def get_c2_workouts(rower):
|
|||||||
workoutid = create_async_workout(alldata,
|
workoutid = create_async_workout(alldata,
|
||||||
rower.user,c2id)
|
rower.user,c2id)
|
||||||
|
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
# get workout metrics, then relay stroke data to an asynchronous task
|
# get workout metrics, then relay stroke data to an asynchronous task
|
||||||
@@ -799,6 +800,7 @@ def get_c2_workout_list(user,page=1):
|
|||||||
return custom_exception_handler(401,s)
|
return custom_exception_handler(401,s)
|
||||||
elif (timezone.now()>r.tokenexpirydate):
|
elif (timezone.now()>r.tokenexpirydate):
|
||||||
s = "Token expired. Needs to refresh."
|
s = "Token expired. Needs to refresh."
|
||||||
|
|
||||||
return custom_exception_handler(401,s)
|
return custom_exception_handler(401,s)
|
||||||
else:
|
else:
|
||||||
# ready to fetch. Hurray
|
# ready to fetch. Hurray
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ def user_is_not_basic(user):
|
|||||||
if user.rower.rowerplan != 'basic':
|
if user.rower.rowerplan != 'basic':
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if user.rower.protrialexpires >= datetime.date.today() and user.rower.plantrialexpires >= datetime.date.today():
|
if user.rower.protrialexpires >= datetime.date.today():
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ from mock import Mock, patch
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
import rowers.c2stuff as c2stuff
|
import rowers.c2stuff as c2stuff
|
||||||
import arrow
|
import arrow
|
||||||
|
from django.http import HttpResponseRedirect
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@@ -172,6 +173,9 @@ def mocked_read_df_sql(id):
|
|||||||
|
|
||||||
return df
|
return df
|
||||||
|
|
||||||
|
def mocked_sendmail(*args,**kwargs):
|
||||||
|
return HttpResponseRedirect('/rowers/email/')
|
||||||
|
|
||||||
def mocked_get_video_data(*args, **kwargs):
|
def mocked_get_video_data(*args, **kwargs):
|
||||||
with open('rowers/tests/testdata/videodata.json','r') as infile:
|
with open('rowers/tests/testdata/videodata.json','r') as infile:
|
||||||
data = json.load(infile)
|
data = json.load(infile)
|
||||||
|
|||||||
@@ -260,13 +260,15 @@ class URLTests(TestCase):
|
|||||||
@patch('requests.get',side_effect=mocked_requests)
|
@patch('requests.get',side_effect=mocked_requests)
|
||||||
@patch('requests.post',side_effect=mocked_requests)
|
@patch('requests.post',side_effect=mocked_requests)
|
||||||
@patch('rowers.dataprep.get_video_data',side_effect=mocked_get_video_data)
|
@patch('rowers.dataprep.get_video_data',side_effect=mocked_get_video_data)
|
||||||
|
@patch('rowers.views.statements.sendmail',side_effect=mocked_sendmail)
|
||||||
def test_url_generator(self,url,expected,
|
def test_url_generator(self,url,expected,
|
||||||
mocked_sqlalchemy,
|
mocked_sqlalchemy,
|
||||||
mocked_read_df_sql,
|
mocked_read_df_sql,
|
||||||
mocked_getsmallrowdata_db,
|
mocked_getsmallrowdata_db,
|
||||||
mock_get,
|
mock_get,
|
||||||
mock_post,
|
mock_post,
|
||||||
mocked_get_video_data):
|
mocked_get_video_data,
|
||||||
|
mocked_sendmail):
|
||||||
|
|
||||||
if url not in tested:
|
if url not in tested:
|
||||||
login = self.c.login(username='john',password='koeinsloot')
|
login = self.c.login(username='john',password='koeinsloot')
|
||||||
|
|||||||
@@ -583,7 +583,13 @@ def do_sync(w,options, quick=False):
|
|||||||
message,id = sporttracksstuff.workout_sporttracks_upload(
|
message,id = sporttracksstuff.workout_sporttracks_upload(
|
||||||
w.user.user,w,asynchron=True,
|
w.user.user,w,asynchron=True,
|
||||||
)
|
)
|
||||||
|
with open('st_export.log','a') as logfile:
|
||||||
|
logfile.write(str(timezone.now())+': ')
|
||||||
|
logfile.write('Workout uploaded '+w.id+'\n')
|
||||||
except NoTokenError:
|
except NoTokenError:
|
||||||
|
with open('st_export.log','a') as logfile:
|
||||||
|
logfile.write(str(timezone.now())+': ')
|
||||||
|
logfile.write(str(w.user)+' NoTokenError\n')
|
||||||
message = "Please connect to SportTracks first"
|
message = "Please connect to SportTracks first"
|
||||||
id = 0
|
id = 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user