diff --git a/collection/games/tests.py b/collection/games/tests.py deleted file mode 100644 index 7ce503c..0000000 --- a/collection/games/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/collection/games/tests/.test_console.py.swp b/collection/games/tests/.test_console.py.swp new file mode 100644 index 0000000..02a229c Binary files /dev/null and b/collection/games/tests/.test_console.py.swp differ diff --git a/collection/games/tests/__init__.py b/collection/games/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/collection/games/tests/test_console.py b/collection/games/tests/test_console.py new file mode 100644 index 0000000..f43c8df --- /dev/null +++ b/collection/games/tests/test_console.py @@ -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)