Merge branch 'develop' into feature/opaqueid
This commit is contained in:
@@ -52,6 +52,17 @@ redis_connection = StrictRedis()
|
||||
|
||||
from django_mailbox.models import Mailbox,MessageAttachment,Message
|
||||
|
||||
def mocked_myqueue(*args, **kwargs):
|
||||
class Job:
|
||||
def __init__(self,*args, **kwargs):
|
||||
self.result = 1
|
||||
self.id = 1
|
||||
|
||||
def revoke(self):
|
||||
return 1
|
||||
|
||||
return Job()
|
||||
|
||||
def mocked_sqlalchemy(*args, **kwargs):
|
||||
# return object with method
|
||||
|
||||
@@ -124,12 +135,44 @@ def mocked_read_df_sql(id):
|
||||
|
||||
return df
|
||||
|
||||
def mocked_getrowdata_db(*args, **kwargs):
|
||||
df = pd.read_csv('rowers/tests/testdata/getrowdata_mock.csv')
|
||||
|
||||
id = kwargs['id']
|
||||
|
||||
row = Workout.objects.get(id=id)
|
||||
|
||||
return df,row
|
||||
|
||||
def mocked_getrowdata_uh(*args, **kwargs):
|
||||
df = pd.read_csv('rowers/tests/testdata/uhfull.csv')
|
||||
|
||||
id = kwargs['id']
|
||||
|
||||
row = Workout.objects.get(id=id)
|
||||
|
||||
return df, row
|
||||
|
||||
def mocked_getsmallrowdata_uh(*args, **kwargs):
|
||||
df = pd.read_csv('rowers/tests/testdata/uhfull.csv')
|
||||
|
||||
return df
|
||||
|
||||
def mocked_getsmallrowdata_forfusion(*args, **kwargs):
|
||||
df = pd.read_csv('rowers/tests/testdata/getrowdata_mock.csv')
|
||||
|
||||
return df
|
||||
|
||||
def mocked_getsmallrowdata_db(*args, **kwargs):
|
||||
df = pd.read_csv('rowers/tests/testdata/colsfromdb.csv')
|
||||
|
||||
return df
|
||||
|
||||
def mocked_getsmallrowdata_db_water(*args, **kwargs):
|
||||
df = pd.read_csv('rowers/tests/testdata/colsfromdb.csv')
|
||||
|
||||
return df
|
||||
|
||||
def mocked_getpowerdata_db(*args, **kwargs):
|
||||
df = pd.read_csv('rowers/tests/testdata/fake_powerdata.csv')
|
||||
|
||||
@@ -535,6 +578,7 @@ def mocked_requests(*args, **kwargs):
|
||||
}
|
||||
|
||||
ststrokesjson = json.load(open('rowers/tests/testdata/sporttracksstrokedata.txt','r'))
|
||||
ststrokesjson_nogps = json.load(open('rowers/tests/testdata/sporttracksstrokedatanolocation.txt','r'))
|
||||
|
||||
rkstrokesjson = json.load(open('rowers/tests/testdata/rkstrokes.txt','r'))
|
||||
|
||||
@@ -609,7 +653,7 @@ def mocked_requests(*args, **kwargs):
|
||||
stworkoutlistregex = '.*?sporttracks\.mobi\/api\/v2\/fitnessActivities$'
|
||||
stworkoutlisttester = re.compile(stworkoutlistregex)
|
||||
|
||||
ststrokesregex = '.*?sporttracks\.mobi\/api\/v2\/fitnessActivities/\d+$'
|
||||
ststrokesregex = '.*?sporttracks\.mobi\/api\/v2\/fitnessActivities/(\d+)$'
|
||||
ststrokestester = re.compile(ststrokesregex)
|
||||
|
||||
rkuploadregex = '.*?api\.runkeeper\.com\/fitnessActivities$'
|
||||
@@ -728,7 +772,10 @@ def mocked_requests(*args, **kwargs):
|
||||
}
|
||||
return MockResponse(json_data,200)
|
||||
if ststrokestester.match(args[0]):
|
||||
return MockResponse(ststrokesjson,200)
|
||||
if ststrokestester.match(args[0]).group(1) == '13':
|
||||
return MockResponse(ststrokesjson_nogps,200)
|
||||
else:
|
||||
return MockResponse(strokesjson,200)
|
||||
if stuploadtester.match(args[0]):
|
||||
json_data = {
|
||||
"uris": [
|
||||
|
||||
Reference in New Issue
Block a user