Changeset c6219ed in OpenWorkouts-current for ow/tests/views/test_workout.py


Ignore:
Timestamp:
Jan 22, 2019, 12:21:51 AM (5 years ago)
Author:
Borja Lopez <borja@…>
Branches:
current, feature/docs, master
Children:
26220ba, 2d2eb0d
Parents:
02048a6 (diff), be40b02 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merged patches from darcs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ow/tests/views/test_workout.py

    r02048a6 rc6219ed  
    429429                assert response.content_type == 'application/xml'
    430430                assert expected_body in response.body
     431
     432    def test_workout_map_no_gpx(self, dummy_request):
     433        request = dummy_request
     434        user = request.root['john']
     435        workout = user.workouts()[0]
     436        response = workout_views.workout_map(workout, request)
     437        assert response == {'start_point': {}}
     438
     439    def test_workout_map(self, dummy_request):
     440        request = dummy_request
     441        user = request.root['john']
     442        workout = user.workouts()[0]
     443        # to ensure has_gpx returns true
     444        workout.tracking_filetype = 'gpx'
     445        gpx_file_path = os.path.join(
     446            os.path.dirname(os.path.dirname(__file__)),
     447            'fixtures/20131013.gpx')
     448        with patch.object(workout, 'tracking_file') as tf:
     449            with open(gpx_file_path, 'r') as gpx_file:
     450                tf.open.return_value = BytesIO(gpx_file.read().encode('utf-8'))
     451                response = workout_views.workout_map(workout, request)
     452                assert response == {
     453                    'start_point': {
     454                        'elevation': None,
     455                        'latitude': 37.108735040304566,
     456                        'longitude': 25.472489344630546
     457                    }
     458                }
Note: See TracChangeset for help on using the changeset viewer.