openbackloggery/collection/games/tests/test_console.py

21 lines
551 B
Python
Raw Normal View History

from django.test import TestCase
from games.models import Console
class ConsoleTest(TestCase):
"""
Console Model
"""
def setUp(self):
Console.objects.create(name='GP2X')
Console.objects.create(name='3DS')
def test_console_are_sorted_by_name(self):
consoles = list(Console.objects.all().values_list('name', flat=True))
sorted_consoles = list(
Console.objects.all().order_by('name').values_list(
'name', flat=True))
self.assertEqual(consoles, sorted_consoles)