Changeset 4678c5e in OpenWorkouts-current for ow/tests/views/test_user.py


Ignore:
Timestamp:
Apr 23, 2019, 6:41:11 PM (5 years ago)
Author:
Borja Lopez <borja@…>
Branches:
current
Children:
e57b2df
Parents:
9f3c353
Message:

(#71) Keep the "distance/time/elevation" filter when clicking on bars
in the profile yearly stats chart

File:
1 edited

Legend:

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

    r9f3c353 r4678c5e  
    414414        # profile page for the current day (no workouts avalable)
    415415        response = user_views.profile(john, request)
    416         assert len(response.keys()) == 7
     416        assert len(response.keys()) == 8
    417417        current_month = datetime.now(timezone.utc).strftime('%Y-%m')
    418418        assert response['user'] == john
     
    432432            'current_sport': 'cycling'
    433433        }
     434        assert response['filter_by'] == 'distance'
    434435        # profile page for a previous date, that has workouts
    435436        request.GET['year'] = 2015
    436437        request.GET['month'] = 6
    437438        response = user_views.profile(john, request)
    438         assert len(response.keys()) == 7
     439        assert len(response.keys()) == 8
    439440        assert response['user'] == john
    440441        assert response['user_gender'] == 'Robot'
     
    448449            'elevation': Decimal(0)
    449450        }
    450         # same, passing a week, first on a week without workouts
     451        assert response['filter_by'] == 'distance'
     452        # same request, but passing a filter_by value
     453        request.GET['filter_by'] = 'time'
     454        response = user_views.profile(john, request)
     455        assert len(response.keys()) == 8
     456        assert response['filter_by'] == 'time'
     457        # same, passing a week, first on a week without workouts,
     458        # keeping the modified filter_by GET param
    451459        request.GET['year'] = 2015
    452460        request.GET['month'] = 6
    453461        request.GET['week'] = 25
    454462        response = user_views.profile(john, request)
    455         assert len(response.keys()) == 7
     463        assert len(response.keys()) == 8
    456464        assert response['user'] == john
    457465        assert response['user_gender'] == 'Robot'
     
    464472            'elevation': Decimal(0)
    465473        }
    466         # now in a week with workouts
     474        assert response['filter_by'] == 'time'
     475        # now in a week with workouts, changing the filter_by again
    467476        request.GET['year'] = 2015
    468477        request.GET['month'] = 6
    469478        request.GET['week'] = 26
     479        request.GET['filter_by'] = 'elevation'
    470480        response = user_views.profile(john, request)
    471         assert len(response.keys()) == 7
     481        assert len(response.keys()) == 8
    472482        assert response['user'] == john
    473483        assert response['user_gender'] == 'Robot'
     
    481491            'elevation': Decimal(0)
    482492        }
     493        assert response['filter_by'] == 'elevation'
    483494
    484495    def test_profile_with_nickname(self, dummy_request, john):
Note: See TracChangeset for help on using the changeset viewer.