Changeset b22a9d2 in OpenWorkouts-current


Ignore:
Timestamp:
Jan 19, 2019, 6:43:01 PM (5 years ago)
Author:
borja <borja@…>
Branches:
current, feature/docs, master
Children:
ceae158
Parents:
d33326a
Message:

Fixed asserts on some workout models tests. Added missing tests covering has_fit

File:
1 edited

Legend:

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

    rd33326a rb22a9d2  
    514514        workout = root['john']['1']
    515515        # without tracking file
    516         assert workout.has_tracking_file is False
     516        assert not workout.has_tracking_file
    517517        # with tracking file
    518518        workout.tracking_file = 'faked tracking file'
    519         assert workout.has_tracking_file is True
     519        assert workout.has_tracking_file
    520520
    521521    def test_has_gpx(self, root):
    522522        workout = root['john']['1']
    523523        # without tracking file
    524         assert workout.has_gpx is False
     524        assert not workout.has_gpx
    525525        workout.tracking_filetype = 'fit'
    526         assert workout.has_gpx is False
     526        assert not workout.has_gpx
    527527        # with non-gpx tracking file
    528528        workout.tracking_file = 'faked tracking file'
    529529        workout.tracking_filetype = 'fit'
    530         assert workout.has_gpx is False
     530        assert not workout.has_gpx
    531531        # with gpx tracking file
    532532        workout.tracking_file = 'faked tracking file'
    533533        workout.tracking_filetype = 'gpx'
    534         assert workout.has_gpx is True
     534        assert workout.has_gpx
     535
     536    def test_has_fit(self, root):
     537        workout = root['john']['1']
     538        # without tracking file
     539        assert not workout.has_fit
     540        # tracking_file is a fit, this should not happen, as uploading a fit
     541        # puts the fit file into .fit_file and generates a gpx for
     542        # .tracking_file
     543        workout.tracking_file = 'faked tracking file'
     544        workout.tracking_filetype = 'fit'
     545        assert not workout.has_fit
     546        # now, having a fit file returns true
     547        workout.fit_file = 'faked fit file'
     548        assert workout.has_fit
     549        # no matter what we have in tracking_file
     550        workout.tracking_filetype = 'gpx'
     551        assert workout.has_fit
     552        workout.tracking_file = None
     553        workout.tracking_filetype = None
     554        assert workout.has_fit
Note: See TracChangeset for help on using the changeset viewer.