Use Django's new UUIDField
[mygpo.git] / mygpo / directory / tests.py
blobb8640c8775e0d6f7642062414fe8aea3b2e6e623
2 # This file is part of my.gpodder.org.
4 # my.gpodder.org is free software: you can redistribute it and/or modify it
5 # under the terms of the GNU Affero General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or (at your
7 # option) any later version.
9 # my.gpodder.org is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
12 # License for more details.
14 # You should have received a copy of the GNU Affero General Public License
15 # along with my.gpodder.org. If not, see <http://www.gnu.org/licenses/>.
18 import unittest
19 import doctest
20 import uuid
21 from datetime import datetime
23 from django.test import TestCase
25 from mygpo.podcasts.models import Podcast
26 from mygpo.directory.views import ToplistView
29 class ToplistTests(unittest.TestCase):
30 """ Test podcast and episode toplists """
32 def test_toplist_languages(self):
33 """ Test the all_languages method of the toplists """
34 languages = ['de', 'de_AT', 'en']
35 for lang in languages:
36 Podcast.objects.create(id=uuid.uuid1(),
37 created=datetime.utcnow(),
38 language=lang,
41 view = ToplistView()
42 all_langs = view.all_languages()
43 self.assertEqual(all_langs, {'de': 'Deutsch', 'en': 'English'})
46 def load_tests(loader, tests, ignore):
47 tests.addTest(unittest.TestLoader().loadTestsFromTestCase(ToplistTests))
48 return tests