should pass tests now
This commit is contained in:
@@ -6,6 +6,7 @@ from __future__ import unicode_literals
|
||||
#from __future__ import print_function
|
||||
from .statements import *
|
||||
nu = datetime.datetime.now()
|
||||
from django.db import transaction
|
||||
|
||||
from rowers.views import add_defaultfavorites
|
||||
|
||||
@@ -50,7 +51,9 @@ class ViewTest(TestCase):
|
||||
'workouttype':'rower',
|
||||
'boattype':'1x',
|
||||
'notes':'aap noot mies',
|
||||
'rpe':4,
|
||||
'make_plot':False,
|
||||
'rpe':6,
|
||||
'upload_to_c2':False,
|
||||
'plottype':'timeplot',
|
||||
'file': f,
|
||||
@@ -100,6 +103,7 @@ class ViewTest(TestCase):
|
||||
'adaptiveclass':'PR1',
|
||||
'workouttype':'rower',
|
||||
'boattype':'1x',
|
||||
'rpe':4,
|
||||
'dragfactor':'112',
|
||||
'private':True,
|
||||
'notes':'noot mies',
|
||||
@@ -141,6 +145,7 @@ class ViewTest(TestCase):
|
||||
'workouttype':'rower',
|
||||
'boattype':'1x',
|
||||
'notes':'aap noot mies',
|
||||
'rpe':6,
|
||||
'make_plot':False,
|
||||
'upload_to_C2':False,
|
||||
'upload_to_Strava':False,
|
||||
@@ -193,6 +198,7 @@ class ViewTest(TestCase):
|
||||
'upload_to_c2':False,
|
||||
'plottype':'timeplot',
|
||||
'file': f,
|
||||
'rpe':6,
|
||||
}
|
||||
|
||||
form = DocumentsForm(form_data,file_data)
|
||||
@@ -229,6 +235,7 @@ class ViewTest(TestCase):
|
||||
'upload_to_c2':False,
|
||||
'plottype':'timeplot',
|
||||
'file': f,
|
||||
'rpe':6,
|
||||
}
|
||||
|
||||
form = DocumentsForm(form_data,file_data)
|
||||
@@ -263,6 +270,7 @@ class ViewTest(TestCase):
|
||||
'upload_to_c2':False,
|
||||
'plottype':'timeplot',
|
||||
'file': f,
|
||||
'rpe':6,
|
||||
}
|
||||
|
||||
form = DocumentsForm(form_data,file_data)
|
||||
@@ -313,6 +321,7 @@ class ViewTest(TestCase):
|
||||
'upload_to_c2':False,
|
||||
'plottype':'timeplot',
|
||||
'file': f,
|
||||
'rpe':6,
|
||||
}
|
||||
|
||||
form = DocumentsForm(form_data,file_data)
|
||||
@@ -350,6 +359,7 @@ class ViewTest(TestCase):
|
||||
'upload_to_c2':False,
|
||||
'plottype':'timeplot',
|
||||
'file': f,
|
||||
'rpe':6,
|
||||
}
|
||||
|
||||
form = DocumentsForm(form_data,file_data)
|
||||
@@ -389,6 +399,7 @@ class ViewTest(TestCase):
|
||||
'upload_to_c2':False,
|
||||
'plottype':'timeplot',
|
||||
'file': f,
|
||||
'rpe':6,
|
||||
}
|
||||
|
||||
form = DocumentsForm(form_data,file_data)
|
||||
@@ -424,6 +435,7 @@ class ViewTest(TestCase):
|
||||
'make_plot':False,
|
||||
'upload_to_c2':False,
|
||||
'plottype':'timeplot',
|
||||
'rpe':1,
|
||||
'file': f,
|
||||
}
|
||||
|
||||
@@ -459,6 +471,7 @@ class ViewTest(TestCase):
|
||||
'boattype':'1x',
|
||||
'notes':'aap noot mies',
|
||||
'make_plot':False,
|
||||
'rpe':1,
|
||||
'upload_to_c2':False,
|
||||
'plottype':'timeplot',
|
||||
'file': f,
|
||||
@@ -531,6 +544,7 @@ class ViewTest(TestCase):
|
||||
file_data = {'file': f}
|
||||
form_data = {
|
||||
'title':'test',
|
||||
'rpe':1,
|
||||
'workouttype':'water',
|
||||
'boattype':'1x',
|
||||
'notes':'aap noot mies',
|
||||
@@ -570,6 +584,7 @@ class ViewTest(TestCase):
|
||||
'make_plot':False,
|
||||
'upload_to_c2':False,
|
||||
'plottype':'timeplot',
|
||||
'rpe':4,
|
||||
'file': f,
|
||||
}
|
||||
|
||||
@@ -623,35 +638,37 @@ class ViewTest(TestCase):
|
||||
|
||||
@patch('rowers.dataprep.create_engine')
|
||||
def test_upload_view_RP_interval(self, mocked_sqlalchemy):
|
||||
self.c.login(username='john',password='koeinsloot')
|
||||
with transaction.atomic():
|
||||
self.c.login(username='john',password='koeinsloot')
|
||||
|
||||
filename = 'rowers/tests/testdata/RP_interval.csv'
|
||||
f = open(filename,'rb')
|
||||
file_data = {'file': f}
|
||||
form_data = {
|
||||
'title':'test',
|
||||
'workouttype':'rower',
|
||||
'boattype':'1x',
|
||||
'notes':'aap noot mies',
|
||||
'make_plot':False,
|
||||
'upload_to_c2':False,
|
||||
'plottype':'timeplot',
|
||||
'file': f,
|
||||
}
|
||||
filename = 'rowers/tests/testdata/RP_interval.csv'
|
||||
f = open(filename,'rb')
|
||||
file_data = {'file': f}
|
||||
form_data = {
|
||||
'title':'test',
|
||||
'workouttype':'rower',
|
||||
'boattype':'1x',
|
||||
'notes':'aap noot mies',
|
||||
'make_plot':False,
|
||||
'upload_to_c2':False,
|
||||
'plottype':'timeplot',
|
||||
'rpe':1,
|
||||
'file': f,
|
||||
}
|
||||
|
||||
form = DocumentsForm(form_data,file_data)
|
||||
form = DocumentsForm(form_data,file_data)
|
||||
|
||||
response = self.c.post('/rowers/workout/upload/', form_data, follow=True)
|
||||
self.assertRedirects(response, expected_url='/rowers/workout/'+encoded1+'/edit/',
|
||||
response = self.c.post('/rowers/workout/upload/', form_data, follow=True)
|
||||
self.assertRedirects(response, expected_url='/rowers/workout/'+encoded1+'/edit/',
|
||||
status_code=302,target_status_code=200)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
w = Workout.objects.get(id=1)
|
||||
f_to_be_deleted = w.csvfilename
|
||||
try:
|
||||
os.remove(f_to_be_deleted+'.gz')
|
||||
except (FileNotFoundError,OSError):
|
||||
pass
|
||||
w = Workout.objects.get(id=1)
|
||||
f_to_be_deleted = w.csvfilename
|
||||
try:
|
||||
os.remove(f_to_be_deleted+'.gz')
|
||||
except (FileNotFoundError,OSError):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -667,6 +684,7 @@ class ViewTest(TestCase):
|
||||
'workouttype':'rower',
|
||||
'boattype':'1x',
|
||||
'notes':'aap noot mies',
|
||||
'rpe':4,
|
||||
'make_plot':False,
|
||||
'upload_to_c2':False,
|
||||
'plottype':'timeplot',
|
||||
@@ -699,6 +717,7 @@ class ViewTest(TestCase):
|
||||
'workouttype':'rower',
|
||||
'boattype':'1x',
|
||||
'notes':'aap noot mies',
|
||||
'rpe':4,
|
||||
'make_plot':False,
|
||||
'upload_to_c2':False,
|
||||
'plottype':'timeplot',
|
||||
@@ -731,6 +750,7 @@ class ViewTest(TestCase):
|
||||
'workouttype':'rower',
|
||||
'boattype':'1x',
|
||||
'notes':'aap noot mies',
|
||||
'rpe':4,
|
||||
'make_plot':False,
|
||||
'upload_to_c2':False,
|
||||
'plottype':'timeplot',
|
||||
@@ -762,6 +782,7 @@ class ViewTest(TestCase):
|
||||
'title':'test',
|
||||
'workouttype':'rower',
|
||||
'boattype':'1x',
|
||||
'rpe':4,
|
||||
'notes':'aap noot mies',
|
||||
'make_plot':False,
|
||||
'upload_to_c2':False,
|
||||
|
||||
Reference in New Issue
Block a user