Skip to content

Instantly share code, notes, and snippets.

@jfridye
Last active August 29, 2015 14:21
Show Gist options
  • Save jfridye/13aba6d8b5516a1312b2 to your computer and use it in GitHub Desktop.
Save jfridye/13aba6d8b5516a1312b2 to your computer and use it in GitHub Desktop.
======================================================================
00:37:48.830 ERROR [0.209s]: test_single_story_does_not_exist (mmf.member.profile.tests.ViewsTest)
00:37:48.830 ----------------------------------------------------------------------
00:37:48.831 Traceback (most recent call last):
00:37:48.831 File "/panama/mmf/member/profile/tests.py", line 117, in test_single_story_does_not_exist
00:37:48.832 'feed_item_id': '0-0000000000'}))
00:37:48.832 File "/usr/lib/python2.6/site-packages/django/test/client.py", line 473, in get
00:37:48.832 response = super(Client, self).get(path, data=data, **extra)
00:37:48.833 File "/usr/lib/python2.6/site-packages/django/test/client.py", line 280, in get
00:37:48.833 return self.request(**r)
00:37:48.833 File "/usr/lib/python2.6/site-packages/django/test/client.py", line 444, in request
00:37:48.834 six.reraise(*exc_info)
00:37:48.834 File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 114, in get_response
00:37:48.835 response = wrapped_callback(request, *callback_args, **callback_kwargs)
00:37:48.835 File "/panama/mmf/member/profile/views.py", line 239, in activity_feed_story
00:37:48.836 story = get_story(feed_item_id, context={'user_id': user_id})
00:37:48.836 File "/panama/mmf/activity_feed/service/activity_feed.py", line 63, in initialize
00:37:48.837 return func(*args, **kwargs)
00:37:48.837 File "/panama/mmf/activity_feed/service/activity_feed.py", line 98, in get_story
00:37:48.838 return activity_story_core.get_story(story_id, context)
00:37:48.838 File "/panama/mmf/activity_feed/core/activity_story.py", line 223, in get_story
00:37:48.839 defer.fulfill()
00:37:48.839 File "/panama/mmf/activity_feed/core/defer.py", line 90, in fulfill
00:37:48.840 _fullfill_source_site()
00:37:48.840 File "/panama/mmf/activity_feed/core/defer.py", line 141, in _fullfill_source_site
00:37:48.840 site = Site.objects.get(pk=key)
00:37:48.840 File "/usr/lib/python2.6/site-packages/django/db/models/manager.py", line 151, in get
00:37:48.841 return self.get_queryset().get(*args, **kwargs)
00:37:48.841 File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line 307, in get
00:37:48.842 self.model._meta.object_name)
00:37:48.842 DoesNotExist: Site matching query does not exist.
def test_single_story_does_not_exist(self):
response = self.client.get(urlresolvers.reverse('activity_feed_story', kwargs={'user_id': str(self.user.id),
'feed_item_id': '0-0000000000'}))
assert response.status_code == 404
def activity_feed_story(request, feed_item_id=None, user_id=None):
story = get_story(feed_item_id, context={'user_id': user_id})
if not story:
raise Http404
context = {
'feed_item_id': feed_item_id,
'site_name': request.site.name,
'profile_url': request.build_absolute_uri(urlresolvers.reverse('user_profile', kwargs={'user_id': user_id})),
}
# render the title of the actvity story server-side for social media purposes
process_template(story, context={'user_id': user_id})
context['story_title'] = story['template']['title']
# if the story is a workout and has a photo attached, attempt to grab the URL
if 'attachments' in story and 'items' in story['attachments']:
for item in story['attachments']['items']:
if 'object' in item and 'type' in item['object'] and item['object']['type'] == 'photo':
context['photo_url'] = item['object']['uri']
break
return render_to_response("/social/single_story.html", request, context_dict=context)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment