Mercurial > public > sg101
annotate potd/tests/tools_tests.py @ 645:99f7917702ca
Fix 081a88b3bfc8, javascript resize of forum images.
Commit 081a88b3bfc8 broke those pages that loaded forums.js but did not load
the imagesLoaded jQuery extension. Now we have arranged it so that only the
forums topic view loads imagesLoaded and put the resizing javascript inline.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Mon, 11 Mar 2013 15:30:25 -0500 |
parents | ee87ea74d46b |
children |
rev | line source |
---|---|
bgneal@515 | 1 """ |
bgneal@515 | 2 Tests for the pick_potd() function. |
bgneal@515 | 3 |
bgneal@515 | 4 """ |
bgneal@515 | 5 from django.test import TestCase |
bgneal@515 | 6 from django.contrib.auth.models import User |
bgneal@515 | 7 |
bgneal@515 | 8 from potd.models import Current, Photo, Sequence |
bgneal@515 | 9 from potd.tools import pick_potd |
bgneal@515 | 10 |
bgneal@515 | 11 |
bgneal@515 | 12 class PickPotdTest(TestCase): |
bgneal@515 | 13 |
bgneal@515 | 14 fixtures = ['potd_test.json'] |
bgneal@515 | 15 |
bgneal@515 | 16 def test_pick(self): |
bgneal@515 | 17 |
bgneal@515 | 18 pick_potd() |
bgneal@515 | 19 |
bgneal@515 | 20 curr = Current.objects.get(pk=1) |
bgneal@515 | 21 self.assertEqual(curr.potd.pk, 2) |
bgneal@515 | 22 |
bgneal@515 | 23 def test_shuffle(self): |
bgneal@515 | 24 |
bgneal@515 | 25 photo = Photo.objects.get(pk=3) |
bgneal@515 | 26 curr = Current.objects.get(pk=1) |
bgneal@515 | 27 curr.potd = photo |
bgneal@515 | 28 curr.save() |
bgneal@515 | 29 |
bgneal@515 | 30 pick_potd() |
bgneal@515 | 31 |
bgneal@515 | 32 ids = Sequence.objects.get(pk=1).seq.split(',') |
bgneal@515 | 33 curr = Current.objects.get(pk=1) |
bgneal@515 | 34 self.assertEqual(len(ids), 3) |
bgneal@515 | 35 self.assertEqual(curr.potd.pk, int(ids[0])) |