Tests : ajout d'un test sur le tri des Consoles

This commit is contained in:
Olivier DOSSMANN 2017-08-17 21:50:29 +02:00
parent 235cb0e453
commit b95407bb70
4 changed files with 20 additions and 3 deletions

View File

@ -1,3 +0,0 @@
from django.test import TestCase
# Create your tests here.

Binary file not shown.

View File

View File

@ -0,0 +1,20 @@
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)