2017-08-17 19:50:29 +00:00
|
|
|
from django.test import TestCase
|
2017-09-16 15:42:04 +00:00
|
|
|
from games.models import Platform
|
2017-08-17 19:50:29 +00:00
|
|
|
|
|
|
|
|
2017-09-16 15:42:04 +00:00
|
|
|
class PlatformTest(TestCase):
|
2017-08-17 19:50:29 +00:00
|
|
|
"""
|
2017-09-16 15:42:04 +00:00
|
|
|
Platform Model
|
2017-08-17 19:50:29 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
def setUp(self):
|
2017-09-16 15:42:04 +00:00
|
|
|
Platform.objects.create(name='GP2X')
|
|
|
|
Platform.objects.create(name='3DS')
|
2017-08-17 19:50:29 +00:00
|
|
|
|
|
|
|
|
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(
|
2017-08-17 19:50:29 +00:00
|
|
|
'name', flat=True))
|
2017-09-16 15:42:04 +00:00
|
|
|
self.assertEqual(platforms, sorted_platforms)
|