from django.test import TestCase from games.models import Platform class PlatformTest(TestCase): """ Platform Model """ def setUp(self): Platform.objects.create(name='GP2X') Platform.objects.create(name='3DS') 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)) self.assertEqual(platforms, sorted_platforms)