Skip to content
This repository has been archived by the owner on Aug 20, 2022. It is now read-only.

Commit

Permalink
#20 test extracted, not finished though
Browse files Browse the repository at this point in the history
  • Loading branch information
podusowski committed Jun 6, 2017
1 parent ff08ec9 commit 39a55e4
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def _timer_rep(self, excercise_id, time_start, time_finished):
now.return_value = time_finished
self.post('/strength/stop_timer/{}'.format(excercise_id))

def test_timer_based_excercise_with_two_reps(self):
def test_timer_based_excercise(self):
self._start_workout()

statistics = self._get_statistics_from_dashboard()
Expand All @@ -300,8 +300,6 @@ def test_timer_based_excercise_with_two_reps(self):
self.post('/strength/add_excercise/{}/'.format(workout.id), {'name': 'plank front'})
excercise = workout.excercise_set.latest('pk')

# add first rep

self._timer_rep(excercise.id, self.ONE_O_CLOCK, self.TWO_O_CLOCK)

self.assertEqual(1, len(excercise.timers_set.all()))
Expand All @@ -310,8 +308,25 @@ def test_timer_based_excercise_with_two_reps(self):
self.assertEqual(self.ONE_O_CLOCK, first_timer.time_started)
self.assertEqual(self.TWO_O_CLOCK, first_timer.time_finished)

# add second rep
statistics = self._get_statistics_from_dashboard()
excercises = statistics.most_popular_workouts()

self.assertEqual('plank front', excercises[0].name)
self.assertEqual(1, excercises[0].count)
#self.assertEqual(units.Volume(seconds=15), excercises[0].volume)
#self.assertEqual(pushups.started, excercises[1].earliest)
#self.assertEqual(more_pushups.started, excercises[1].latest)

def test_timer_based_excercise_with_two_reps(self):
self._start_workout()

statistics = self._get_statistics_from_dashboard()
workout = statistics.previous_workouts()[0]

self.post('/strength/add_excercise/{}/'.format(workout.id), {'name': 'plank front'})
excercise = workout.excercise_set.latest('pk')

self._timer_rep(excercise.id, self.ONE_O_CLOCK, self.TWO_O_CLOCK)
self._timer_rep(excercise.id, self.THREE_O_CLOCK, self.FOUR_O_CLOCK)

self.assertEqual(2, len(excercise.timers_set.all()))
Expand Down

0 comments on commit 39a55e4

Please sign in to comment.