Adds test

master
Ruben Dura Tari 2016-10-11 19:47:17 +01:00
parent 3c2935776e
commit e4355d84bc
2 changed files with 15 additions and 0 deletions

2
.gitignore vendored
View File

@ -10,3 +10,5 @@ atlassian-*
.ropeproject .ropeproject
.codeintel .codeintel
__pycache__ __pycache__
.venv/
build

View File

@ -4,6 +4,7 @@ except ImportError:
import http.client as httplib import http.client as httplib
import json import json
import uuid
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.db import models from django.db import models
@ -27,6 +28,14 @@ class TestSortableModel(SortableMixin):
return self.title return self.title
class TestNonAutoFieldModel(SortableMixin):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
order = models.PositiveIntegerField(editable=False, db_index=True)
class Meta:
ordering = ['order']
class SortableTestCase(TestCase): class SortableTestCase(TestCase):
def setUp(self): def setUp(self):
self.client = Client() self.client = Client()
@ -325,3 +334,7 @@ class SortableTestCase(TestCase):
] ]
self.assertEqual(notes, expected_notes) self.assertEqual(notes, expected_notes)
def test_save_non_auto_field_model(self):
model = TestNonAutoFieldModel()
model.save()