示例#1
0
文件: tests.py 项目: kahnjw/mileagebe
 def test_strava_activities_endpoint_takes_query_parameters(self):
     request = self.factory.get('fake/url', {
         'distance': 'miles',
         'max_speed': 'miles.hour'
     })
     request.user = self.user
     StravaActivities.as_view()(request)
     self.client.get_activities.assert_called_with(
         request.user, distance='miles', max_speed=['miles', 'hour'])
示例#2
0
文件: urls.py 项目: kahnjw/mileagebe
from django.conf.urls import patterns, url

from strava_client.views import StravaUser, StravaActivities


urlpatterns = patterns(
    '',
    url(r'me/?$', StravaUser.as_view(), name='strava-me'),
    url(r'activities/?$', StravaActivities.as_view(), name='strava-activites')
)
示例#3
0
文件: tests.py 项目: kahnjw/mileagebe
 def test_strava_activities_endpoint_returns_activities_data(self):
     response = StravaActivities.as_view()(self.request)
     response.render()
     self.assertEqual(json.loads(response.content), {'distance': 10})