Private
Public Access
1
0

committing survey

This commit is contained in:
Sander Roosendaal
2020-01-08 22:43:41 +01:00
parent cfc61e8621
commit 09a490c064
25 changed files with 572 additions and 597 deletions

View File

@@ -9,7 +9,7 @@ nu = datetime.datetime.now()
#@pytest.mark.django_db
#@pytest.mark.django_db
@override_settings(TESTING=True)
class PlotTests(TestCase):
def setUp(self):
@@ -18,7 +18,7 @@ class PlotTests(TestCase):
'sander@ds.ds',
'koeinsloot')
r = Rower.objects.create(user=u,
gdproptin=True,
gdproptin=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='basic')
self.nu = datetime.datetime.now()
@@ -29,14 +29,14 @@ class PlotTests(TestCase):
starttime=self.nu.strftime('%H:%M:%S'),
duration="0:55:00",distance=8000,
csvfilename=filename)
self.wote = Workout.objects.create(name='testworkout',
workouttype='Indoor Rower',
user=r,date=self.nu.strftime('%Y-%m-%d'),
starttime=self.nu.strftime('%H:%M:%S'),
duration="0:55:00",distance=8000,
csvfilename=filename)
# timestr = strftime("%Y%m%d-%H%M%S")
# imagename = f1+timestr+'.png'
# fullpathimagename = 'static/plots/'+imagename
@@ -45,7 +45,7 @@ class PlotTests(TestCase):
r.pw_at,
r.pw_tr,r.pw_an])/r.ftp
self.hrdata = {
'hrmax':r.max,
'hrut2':r.ut2,
@@ -64,7 +64,7 @@ class PlotTests(TestCase):
@patch('rowers.tasks.FigureCanvas')
def test_ote_plots(self, mocked_rowingdata, mocked_canvas):
w = self.wote
f1 = 'testdata.csv'[:-4]
f1 = 'testdata.csv'[:-4]
timestr = strftime("%Y%m%d-%H%M%S")
imagename = f1+timestr+'.png'
fullpathimagename = 'static/plots/'+imagename
@@ -72,7 +72,7 @@ class PlotTests(TestCase):
plotnr = 1
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,
@@ -85,7 +85,7 @@ class PlotTests(TestCase):
plotnr = 1
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,
@@ -98,7 +98,7 @@ class PlotTests(TestCase):
plotnr = 2
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,
@@ -111,7 +111,7 @@ class PlotTests(TestCase):
plotnr = 3
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,
@@ -124,7 +124,7 @@ class PlotTests(TestCase):
plotnr = 4
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,
@@ -137,7 +137,7 @@ class PlotTests(TestCase):
plotnr = 5
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,
@@ -150,7 +150,7 @@ class PlotTests(TestCase):
plotnr = 6
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,
@@ -163,7 +163,7 @@ class PlotTests(TestCase):
plotnr = 7
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,
@@ -176,7 +176,7 @@ class PlotTests(TestCase):
plotnr = 8
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,
@@ -189,7 +189,7 @@ class PlotTests(TestCase):
plotnr = 13
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,
@@ -203,7 +203,7 @@ class PlotTests(TestCase):
@patch('rowers.tasks.FigureCanvas')
def test_chartrequests(self, mocked_rowingdata, mocked_canvas):
opid = encoder.encode_hex(self.wotw.id)
url = reverse('workout_add_chart_view',
kwargs={'id':opid,
'plotnr':13
@@ -212,7 +212,7 @@ class PlotTests(TestCase):
workout_edit_url = reverse('workout_edit_view',
kwargs={'id':opid})
login = self.c.login(username='john', password='koeinsloot')
self.assertTrue(login)
@@ -246,12 +246,12 @@ class PlotTests(TestCase):
self.assertEqual(len(i),0)
@patch('rowers.tasks.rdata')
@patch('rowers.tasks.FigureCanvas')
def test_otw_plots(self, mocked_rowingdata, mocked_canvas):
w = self.wotw
f1 = 'testdata.csv'[:-4]
f1 = 'testdata.csv'[:-4]
timestr = strftime("%Y%m%d-%H%M%S")
imagename = f1+timestr+'.png'
fullpathimagename = 'static/plots/'+imagename
@@ -259,7 +259,7 @@ class PlotTests(TestCase):
plotnr = 1
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,
@@ -272,7 +272,7 @@ class PlotTests(TestCase):
plotnr = 1
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,
@@ -285,7 +285,7 @@ class PlotTests(TestCase):
plotnr = 2
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,
@@ -298,7 +298,7 @@ class PlotTests(TestCase):
plotnr = 3
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,
@@ -311,7 +311,7 @@ class PlotTests(TestCase):
plotnr = 4
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,
@@ -324,7 +324,7 @@ class PlotTests(TestCase):
plotnr = 5
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,
@@ -337,7 +337,7 @@ class PlotTests(TestCase):
plotnr = 6
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,
@@ -350,7 +350,7 @@ class PlotTests(TestCase):
plotnr = 7
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,
@@ -363,7 +363,7 @@ class PlotTests(TestCase):
plotnr = 8
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,
@@ -376,7 +376,7 @@ class PlotTests(TestCase):
plotnr = 9
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,
@@ -389,7 +389,7 @@ class PlotTests(TestCase):
plotnr = 13
if (w.workouttype=='water'):
plotnr = plotnr+3
res = handle_makeplot(f1,w.csvfilename,
w.name,self.hrdata,plotnr,imagename)
i = GraphImage(workout=w,creationdatetime=self.nu,