21 lines
551 B
Python
21 lines
551 B
Python
|
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)
|