openbackloggery/collection/games/tests/test_console.py

21 lines
563 B
Python
Raw Permalink Normal View History

from django.test import TestCase
2017-09-16 15:42:04 +00:00
from games.models import Platform
2017-09-16 15:42:04 +00:00
class PlatformTest(TestCase):
"""
2017-09-16 15:42:04 +00:00
Platform Model
"""
def setUp(self):
2017-09-16 15:42:04 +00:00
Platform.objects.create(name='GP2X')
Platform.objects.create(name='3DS')
2017-09-16 15:42:04 +00:00
def test_platform_are_sorted_by_name(self):
platforms = list(Platform.objects.all().values_list('name', flat=True))
sorted_platforms = list(
Platform.objects.all().order_by('name').values_list(
'name', flat=True))
2017-09-16 15:42:04 +00:00
self.assertEqual(platforms, sorted_platforms)