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

@@ -33,10 +33,10 @@ def create_image(storage, filename, size=(100, 100), image_mode='RGB', image_for
class WorkoutViewTest(TestCase):
def setUp(self):
self.u = UserFactory()
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
gdproptin=True,
gdproptin=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach')
@@ -48,7 +48,7 @@ class WorkoutViewTest(TestCase):
self.u.save()
result = get_random_file(filename='rowers/tests/testdata/onwater2.csv')
self.wwater = WorkoutFactory(user=self.r,
csvfilename=result['filename'],
starttime=result['starttime'],
@@ -75,7 +75,7 @@ class WorkoutViewTest(TestCase):
)
result = get_random_file(filename='rowers/tests/testdata/erg1.csv')
self.werg1 = WorkoutFactory(user=self.r,
csvfilename=result['filename'],
starttime=result['starttime'],
@@ -86,7 +86,7 @@ class WorkoutViewTest(TestCase):
)
result = get_random_file(filename='rowers/tests/testdata/erg2.csv')
self.werg2 = WorkoutFactory(user=self.r,
csvfilename=result['filename'],
starttime=result['starttime'],
@@ -97,7 +97,7 @@ class WorkoutViewTest(TestCase):
)
result = get_random_file(filename='rowers/tests/testdata/erg2.csv')
self.werg2copy = WorkoutFactory(user=self.r,
csvfilename=result['filename'],
starttime=result['starttime'],
@@ -107,9 +107,9 @@ class WorkoutViewTest(TestCase):
workouttype = 'rower',
)
result = get_random_file(filename='rowers/tests/testdata/erg3.csv')
self.werg3 = WorkoutFactory(user=self.r,
csvfilename=result['filename'],
starttime=result['starttime'],
@@ -141,7 +141,7 @@ class WorkoutViewTest(TestCase):
response = self.c.post(url,form_data)
self.assertEqual(response.status_code,200)
@patch('rowers.dataprep.create_engine')
@patch('rowers.dataprep.getsmallrowdata_db')
def test_joins(self, mocked_sqlalchemy, mocked_getsmallrowdata_db):
@@ -154,7 +154,7 @@ class WorkoutViewTest(TestCase):
d1 = self.werg1.date-datetime.timedelta(days=2)
d2 = self.werg2.date+datetime.timedelta(days=2)
date_form_data = {
'startdate': d1.strftime('%Y-%m%d'),
'enddate': d2.strftime('%Y-%m%d')
@@ -162,7 +162,7 @@ class WorkoutViewTest(TestCase):
response = self.c.post(url,date_form_data)
self.assertEqual(response.status_code,200)
url = reverse('workouts_join_view')
response = self.c.get(url,follow=True)
@@ -197,7 +197,7 @@ class WorkoutViewTest(TestCase):
self.assertRedirects(response,
expected_url=expected_url,
status_code=302,target_status_code=200)
@patch('rowers.dataprep.create_engine')
@patch('rowers.dataprep.getsmallrowdata_db')
@patch('rowers.middleware.myqueue')
@@ -224,8 +224,8 @@ class WorkoutViewTest(TestCase):
'plottype':'line',
'teamid': '',
}
response = self.c.post(url,form_data,follow=True)
self.assertEqual(response.status_code,200)
@@ -269,7 +269,7 @@ class WorkoutViewTest(TestCase):
response = self.c.get(url,follow=True)
self.assertEqual(response.status_code,200)
@patch('rowers.dataprep.create_engine')
@patch('rowers.dataprep.getsmallrowdata_db')
def test_smoothen(self, mocked_sqlalchemy, mocked_getsmallrowdata_db):
@@ -287,7 +287,7 @@ class WorkoutViewTest(TestCase):
'id':encoder.encode_hex(self.wwater.id)
}
)
self.assertRedirects(response,
expected_url=expected_url,
status_code=302,target_status_code=200)
@@ -302,12 +302,12 @@ class WorkoutViewTest(TestCase):
'id':encoder.encode_hex(self.wwater.id)
}
)
self.assertRedirects(response,
expected_url=expected_url,
status_code=302,target_status_code=200)
@patch('rowers.dataprep.create_engine')
@patch('rowers.dataprep.getsmallrowdata_db')
def test_windform(self, mocked_sqlalchemy, mocked_getsmallrowdata_db):
@@ -363,7 +363,7 @@ class WorkoutViewTest(TestCase):
self.assertEqual(response.status_code,200)
@patch('rowers.dataprep.create_engine')
@patch('rowers.dataprep.getsmallrowdata_db')
def test_setpowerform(self, mocked_sqlalchemy, mocked_getsmallrowdata_db):
@@ -409,7 +409,7 @@ class WorkoutViewTest(TestCase):
self.assertRedirects(response,
expected_url=expected_url,
status_code=302,target_status_code=200)
@patch('rowers.dataprep.create_engine')
@patch('rowers.dataprep.getsmallrowdata_db')
def test_commentview(self, mocked_sqlalchemy, mocked_getsmallrowdata_db):
@@ -435,7 +435,7 @@ class WorkoutViewTest(TestCase):
url = reverse('workout_unsubscribe_view',kwargs={'id':encoder.encode_hex(self.wwater.id)})
response = self.c.get(url)
self.assertEqual(response.status_code,200)
@patch('rowers.dataprep.create_engine')
@patch('rowers.dataprep.getsmallrowdata_db')
def test_mapview(self, mocked_sqlalchemy, mocked_getsmallrowdata_db):
@@ -471,7 +471,7 @@ class WorkoutViewTest(TestCase):
#if not form.is_valid():
# print form.errors
#self.assertTrue(form.is_valid())
response = self.c.post(url,form_data,format='multipart',follow=True)
expected_url = reverse(self.r.defaultlandingpage,
@@ -480,7 +480,7 @@ class WorkoutViewTest(TestCase):
self.assertRedirects(response,
expected_url=expected_url,
status_code=302,target_status_code=200)
@patch('rowers.dataprep.create_engine')
@patch('rowers.dataprep.getsmallrowdata_db')
@patch('rowers.dataprep.getrowdata_db',side_effect=mocked_getrowdata_db)
@@ -536,7 +536,7 @@ class WorkoutViewTest(TestCase):
response = self.c.post(url,form_data,follow=True)
self.assertEqual(response.status_code,200)
@patch('rowers.dataprep.create_engine')
@patch('rowers.dataprep.getsmallrowdata_db')
def test_editsummaryview(self, mocked_sqlalchemy, mocked_getsmallrowdata_db):
@@ -590,7 +590,7 @@ class WorkoutViewTest(TestCase):
response = self.c.post(url,form_data)
self.assertEqual(response.status_code,200)
@patch('rowers.dataprep.create_engine')
@patch('rowers.dataprep.getsmallrowdata_db')
def test_workout_delete(self, mocked_sqlalchemy, mocked_getsmallrowdata_db):
@@ -611,4 +611,3 @@ class WorkoutViewTest(TestCase):
self.assertRedirects(response,
expected_url=expected_url,
status_code=302,target_status_code=200)