Changeset 0dedfbe in OpenWorkouts-current for ow/tests/models/test_workout.py
- Timestamp:
- Apr 22, 2019, 10:47:55 PM (5 years ago)
- Branches:
- current
- Children:
- a6fa857
- Parents:
- 42baca4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ow/tests/models/test_workout.py
r42baca4 r0dedfbe 143 143 workout.distance = 44.44444444 144 144 assert workout.rounded_distance == 44.44 145 146 def test_hashed(self, root): 147 # first test a workout that is attached to a user 148 workout = root['john']['1'] 149 assert workout.hashed == ( 150 str(workout.owner.uid) + 151 workout.start.strftime('%Y%m%d%H%M%S') + 152 str(workout.duration.seconds) + 153 str(workout.distance) 154 ) 155 # now a workout that is not (no owner info) 156 workout = Workout( 157 start_time=datetime.now(timezone.utc), 158 duration=timedelta(seconds=3600), 159 distance=Decimal(30) 160 ) 161 assert workout.hashed == ( 162 workout.start.strftime('%Y%m%d%H%M%S') + 163 str(workout.duration.seconds) + 164 str(workout.distance) 165 ) 166 # now an empty workout... 167 workout = Workout() 168 with pytest.raises(AttributeError): 169 assert workout.hashed == ( 170 workout.start.strftime('%Y%m%d%H%M%S') + 171 str(workout.duration.seconds) + 172 str(workout.distance) 173 ) 145 174 146 175 def test_trimmed_notes(self):
Note: See TracChangeset
for help on using the changeset viewer.