Changeset 0dedfbe in OpenWorkouts-current for ow/tests/models/test_root.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_root.py
r42baca4 r0dedfbe 2 2 from unittest.mock import Mock 3 3 from datetime import datetime, timedelta, timezone 4 from decimal import Decimal 4 5 5 6 import pytest … … 175 176 john.add_workout(workout) 176 177 assert root.sports_json == json.dumps(["cycling", "running"]) 178 179 def test_get_workout_by_hash(self, root, john): 180 # non existant hash 181 found = root.get_workout_by_hash('non-existant-hash') 182 assert found is None 183 # existing workout 184 workout = root[str(john.uid)]['1'] 185 found = root.get_workout_by_hash(workout.hashed) 186 assert found == workout 187 # a workout that was not added to the system 188 workout = Workout( 189 start_time=datetime.now(timezone.utc), 190 duration=timedelta(seconds=3600), 191 distance=Decimal(30) 192 ) 193 found = root.get_workout_by_hash(workout.hashed) 194 assert found is None
Note: See TracChangeset
for help on using the changeset viewer.