Skip to content
This repository has been archived by the owner on May 3, 2023. It is now read-only.

Commit

Permalink
Added some testing for the mentions route.
Browse files Browse the repository at this point in the history
  • Loading branch information
SoftlySplinter committed Feb 1, 2013
1 parent c072d72 commit 21168fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tentd/blueprints/posts.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ def get(self, post_id):
@posts.route_class('/<string:post_id>/mentions', endpoint='mentions')
class MentionsView(MethodView):
def get(self, post_id):
return jsonify(g.entity.post.get_or_404(id=post_id).mentions)
return jsonify(g.entity.posts.get_or_404(id=post_id).versions[0].mentions)
7 changes: 7 additions & 0 deletions tentd/tests/blueprints/test_posts.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ def test_delete_post_version(self):
self.assertJSONError(self.client.delete(
'/testuser/posts/{}?version=0'.format(self.post.id)))

def test_get_post_mentions(self):
"""Test that the mentions of a post can be returned."""
resp = self.client.get('/{}/posts/{}/mentions'.format(self.name,
self.post.id))
self.assertStatus(resp, 200)
assert resp.json() == self.post.versions[0].mentions

class MorePostsTest(EntityTentdTestCase):
"""Tests for posts without having existing posts."""
def test_create_invalid_post(self):
Expand Down

0 comments on commit 21168fa

Please sign in to comment.