Changeset d517001 in OpenWorkouts-current for ow/tests/views/test_workout.py
- Timestamp:
- Feb 15, 2019, 6:09:04 PM (5 years ago)
- Branches:
- current, feature/docs, master
- Children:
- d5429c5
- Parents:
- d459ee2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ow/tests/views/test_workout.py
rd459ee2 rd517001 126 126 assert len(response['form'].form.errors) == 6 127 127 128 def test_add_workout_manually_post_valid(self, valid_post_request): 128 add_workout_params = [ 129 # no title, no sport, we generate a title based on when the 130 # workout started 131 ({'title': None, 'sport': None}, 'Morning workout'), 132 # no title, sport given, we use the sport too in the automatically 133 # generated title 134 ({'title': None, 'sport': 'cycling'}, 'Morning cycling workout'), 135 # title given, no sport, we use the provided title 136 ({'title': 'Example workout', 'sport': None}, 'Example workout'), 137 # title given, sport too, we use the provided title 138 ({'title': 'Example workout', 'sport': 'cycling'}, 'Example workout'), 139 ] 140 141 @pytest.mark.parametrize(('params', 'expected'), add_workout_params) 142 def test_add_workout_manually_post_valid(self, params, expected, 143 valid_post_request): 129 144 """ 130 145 POST request to add a workout manually, providing the needed data 131 146 """ 132 147 request = valid_post_request 148 if params['title'] is not None: 149 request.POST['title'] = params['title'] 150 if params['sport'] is not None: 151 request.POST['sport'] = params['sport'] 133 152 user = request.root['john'] 134 153 assert len(user.workouts()) == 1 … … 137 156 assert response.location.endswith('/2/') 138 157 assert len(user.workouts()) == 2 158 assert user['2'].title == expected 139 159 140 160 def test_add_workout_get(self, dummy_request):
Note: See TracChangeset
for help on using the changeset viewer.