increase test coverage
This commit is contained in:
@@ -340,13 +340,13 @@ def mocked_getsmallrowdata_db_updatecp(*args, **kwargs):
|
||||
return df
|
||||
|
||||
def mocked_getsmallrowdata_db_setcp(*args, **kwargs):
|
||||
df = pd.read_csv('rowers/tests/testdata/colsfromdb.csv')
|
||||
df = pd.read_csv('rowers/tests/testdata/colsfromdb2.csv')
|
||||
|
||||
return df
|
||||
|
||||
|
||||
def mocked_getsmallrowdata_db_water(*args, **kwargs):
|
||||
df = pd.read_csv('rowers/tests/testdata/colsfromdb.csv')
|
||||
df = pd.read_csv('rowers/tests/testdata/colsfromdb3.csv')
|
||||
|
||||
return df
|
||||
|
||||
|
||||
@@ -502,15 +502,15 @@ class AsyncTaskTests(TestCase):
|
||||
self.assertEqual(res,1)
|
||||
|
||||
|
||||
@patch('rowers.dataprepnodjango.getsmallrowdata_db_updatecp')
|
||||
def test_handle_updatecp(self,mocked_getsmallrowdata_db):
|
||||
@patch('rowers.dataprepnodjango.getsmallrowdata_db')
|
||||
def test_handle_updatecp(self,mocked_getsmallrowdata_db_updatecp):
|
||||
rower_id = 1
|
||||
workoutids = [1]
|
||||
res = tasks.handle_updatecp(rower_id,workoutids)
|
||||
self.assertEqual(res,1)
|
||||
|
||||
@patch('rowers.dataprepnodjango.getsmallrowdata_db_setcp')
|
||||
def test_handle_setcp(self,mocked_getsmallrowdata_db):
|
||||
@patch('rowers.dataprepnodjango.getsmallrowdata_db')
|
||||
def test_handle_setcp(self,mocked_getsmallrowdata_db_db_setcp):
|
||||
strokesdf = pd.read_csv('rowers/tests/testdata/uhfull.csv')
|
||||
filename = 'rowers/tests/testdata/temp/pq.gz'
|
||||
workoutids = 1
|
||||
|
||||
@@ -385,39 +385,6 @@ class C2Objects(DjangoTestCase):
|
||||
|
||||
|
||||
|
||||
@patch('rowers.dataprep.create_engine')
|
||||
def test_strokedata(self, mocked_sqlalchemy):
|
||||
with open('rowers/tests/testdata/c2stroketestdata.txt','r') as infile:
|
||||
res = json.load(infile)
|
||||
|
||||
strokedata = pd.DataFrame.from_dict(res['data'])
|
||||
|
||||
with open('rowers/tests/testdata/c2testdata.txt','r') as infile:
|
||||
res = json.load(infile)
|
||||
|
||||
data = res['data']
|
||||
|
||||
from rowers.views import add_workout_from_strokedata
|
||||
|
||||
res = add_workout_from_strokedata(self.u,1,data,strokedata,source='c2')
|
||||
|
||||
@patch('rowers.dataprep.create_engine')
|
||||
def test_strokedatanohr(self, mocked_sqlalchemy):
|
||||
with open('rowers/tests/testdata/c2strokedatanohr.txt','r') as infile:
|
||||
res = json.load(infile)
|
||||
|
||||
strokedata = pd.DataFrame.from_dict(res['data'])
|
||||
|
||||
with open('rowers/tests/testdata/c2testdata.txt','r') as infile:
|
||||
res = json.load(infile)
|
||||
|
||||
data = res['data']
|
||||
|
||||
from rowers.views import add_workout_from_strokedata
|
||||
|
||||
|
||||
res = add_workout_from_strokedata(self.u,1,data,strokedata,source='c2')
|
||||
|
||||
@patch('rowers.tasks.requests.get',side_effect=mocked_requests)
|
||||
@patch('rowers.tasks.requests.post',side_effect=mocked_requests)
|
||||
@patch('rowers.tasks.requests.session', side_effect=mocked_requests)
|
||||
|
||||
1399
rowers/tests/testdata/colsfromdb2.csv
vendored
Normal file
1399
rowers/tests/testdata/colsfromdb2.csv
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1399
rowers/tests/testdata/colsfromdb3.csv
vendored
Normal file
1399
rowers/tests/testdata/colsfromdb3.csv
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user