Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added more tests; minor documentation tweak

git-svn-id: https://django-voting.googlecode.com/svn/trunk@51 662f01ad-f42a-0410-a340-718c64ddaef4
  • Loading branch information...
commit decaa841791a5754d6308b1146053ea0e449566e 1 parent 4df7a03
Jonny Buchanan insin authored
Showing with 16 additions and 2 deletions.
  1. +3 −2 README.txt
  2. +13 −0 tests/tests.py
5 README.txt
View
@@ -22,8 +22,9 @@ If you've already downloaded, rename the directory before installing.
To install django-voting, do the following:
- 1. Put ``'voting'`` in your ``INSTALLED_APPS`` setting.
- 2. Run the command ``manage.py syncdb``.
+ 1. Put the ``voting`` folder somewhere on your Python path.
+ 2. Put ``'voting'`` in your ``INSTALLED_APPS`` setting.
+ 3. Run the command ``manage.py syncdb``.
The ``syncdb`` command creates the necessary database tables and
creates permission objects for all installed apps that need them.
13 tests/tests.py
View
@@ -67,4 +67,17 @@
>>> Vote.objects.get_for_user_in_bulk([], users[0])
{}
+>>> for user in users[1:]:
+... Vote.objects.record_vote(i2, user, +1)
+... Vote.objects.record_vote(i3, user, +1)
+... Vote.objects.record_vote(i4, user, +1)
+>>> list(Vote.objects.get_top(Item))
+[(<Item: test2>, 4), (<Item: test4>, 3), (<Item: test3>, 2)]
+>>> for user in users[1:]:
+... Vote.objects.record_vote(i2, user, -1)
+... Vote.objects.record_vote(i3, user, -1)
+... Vote.objects.record_vote(i4, user, -1)
+>>> list(Vote.objects.get_bottom(Item))
+[(<Item: test3>, -4), (<Item: test4>, -3), (<Item: test2>, -2)]
+
"""
Please sign in to comment.
Something went wrong with that request. Please try again.