Show consecutive stall count beside previous performance
This commit is contained in:
@@ -91,11 +91,31 @@ class WorkoutViewTests(unittest.TestCase):
|
||||
|
||||
def test_previous_performance_is_loaded_on_expansion(self):
|
||||
self.db.get_most_recent_topset_for_exercise.return_value = (7, 93.5, 'Smith Press')
|
||||
self.db.get_recent_topsets_for_exercise.return_value = [self.top_sets[0]]
|
||||
response = self.client.get(self.base + '/exercise/most_recent_topset_for_exercise?exercise_id=1')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn(b'toggle once from:closest details', response.data)
|
||||
self.assertNotIn(b'hx-trigger=load', response.data)
|
||||
self.assertIn(b'Previous performance', response.data)
|
||||
self.assertNotIn(b'workout-stall-badge', response.data)
|
||||
|
||||
def test_previous_performance_shows_consecutive_stall_count(self):
|
||||
self.db.get_most_recent_topset_for_exercise.return_value = (7, 93.5, 'Smith Press')
|
||||
self.db.get_recent_topsets_for_exercise.return_value = [self.top_sets[0]]
|
||||
for count, label in ((1, b'Stalled 1 time'), (3, b'Stalled 3 times')):
|
||||
self.db.get_topset_achievements.return_value = {'stalled_sessions': count}
|
||||
response = self.client.get(self.base + '/exercise/most_recent_topset_for_exercise?exercise_id=1')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn(label, response.data)
|
||||
self.assertIn('7 × 93.5 kg', response.get_data(as_text=True))
|
||||
self.db.get_topset_achievements.assert_called_with(1)
|
||||
|
||||
def test_previous_performance_without_history_hides_stall_badge(self):
|
||||
self.db.get_most_recent_topset_for_exercise.return_value = (None, None, 'Smith Press')
|
||||
response = self.client.get(self.base + '/exercise/most_recent_topset_for_exercise?exercise_id=1')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertNotIn(b'workout-stall-badge', response.data)
|
||||
self.db.get_recent_topsets_for_exercise.assert_not_called()
|
||||
|
||||
def test_create_edit_cancel_update_and_delete_targets(self):
|
||||
data = dict(exercise_id=1, repetitions=8, weight=93.5)
|
||||
|
||||
Reference in New Issue
Block a user