Changeset 53bb3e5 in OpenWorkouts-current for ow/tests


Ignore:
Timestamp:
Jan 9, 2019, 12:31:33 PM (5 years ago)
Author:
borja <borja@…>
Branches:
current, feature/docs, master
Children:
119412d
Parents:
e3d7b13
Message:

(#13) - fit files parsing + (#26) - generate .gpx from .fit

  • Added fitparse as a new dependency IMPORTANT: please install it in your existing envs:

pip install python-fitparse

  • Added new attribute to workouts to store attached fit files as Blob objects. IMPORTANT: please update any workouts you have in your db, adding the fit_file attribute to them (None by default)
  • Added new module with the code needed to interact with .fit files (parse, gather data, transform to gpx)
  • Added code to "load" a workout from a fit file
  • Added tools and helpers to transform values (meters->kilometers, meters-per-second->kms-per-hour, semicircles-to-degrees, etc)
  • Refactored some imports
File:
1 edited

Legend:

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

    re3d7b13 r53bb3e5  
    33from datetime import datetime, timedelta, timezone
    44from decimal import Decimal
    5 from unittest.mock import patch
     5from unittest.mock import patch, Mock
    66
    77import pytest
     
    195195        assert workout.atemp['max'] == 12
    196196        assert workout.atemp['avg'] == 5
     197
     198    def test_tracking_file_path(self):
     199        workout = Workout()
     200        # no tracking file, path is None
     201        assert workout.tracking_file_path is None
     202        # workout still not saved to the db
     203        workout.tracking_file = Mock()
     204        workout.tracking_file._p_blob_uncommitted = '/tmp/blobtempfile'
     205        workout.tracking_file._p_blob_committed = None
     206        assert workout.tracking_file_path == '/tmp/blobtempfile'
     207        workout.tracking_file._p_blob_uncommitted = None
     208        workout.tracking_file._p_blob_committed = '/var/db/blobs/blobfile'
     209        assert workout.tracking_file_path == '/var/db/blobs/blobfile'
    197210
    198211    def test_load_from_file_invalid(self):
Note: See TracChangeset for help on using the changeset viewer.