Private
Public Access
1
0

force curve with workstrokesonly

This commit is contained in:
Sander Roosendaal
2019-02-08 10:12:09 +01:00
parent d13f5be6f7
commit 77aba205c5
7 changed files with 424 additions and 269 deletions

View File

@@ -0,0 +1,52 @@
from statements import *
nu = datetime.datetime.now()
class WaterWorkoutViewTest(TestCase):
def setUp(self):
self.u = UserFactory()
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
gdproptin=True,
gdproptindate=timezone.now(),
rowerplan='coach')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
self.factory = RequestFactory()
self.password = faker.word()
self.u.set_password(self.password)
self.u.save()
result = get_random_file(filename='rowers/tests/testdata/onwater.csv')
self.wwater = WorkoutFactory(user=self.r,
csvfilename=result['filename'],
starttime=result['starttime'],
startdatetime=result['startdatetime'],
duration=result['duration'],
distance=result['totaldist']
)
def tearDown(self):
pass
@patch('rowers.dataprep.create_engine')
@patch('rowers.dataprep.getsmallrowdata_db')
def test_forcecurve(self, mocked_sqlalchemy, mocked_getsmallrowdata_db):
login = self.c.login(username=self.u.username, password=self.password)
self.assertTrue(login)
url = reverse('workout_forcecurve_view',kwargs={'id':self.wwater.id})
response = self.c.get(url)
self.assertEqual(response.status_code,200)
form_data = {
'workstrokesonly': True
}
response = self.c.post(url,form_data)
self.assertEqual(response.status_code,200)