Adds test
This commit is contained in:
@@ -10,3 +10,5 @@ atlassian-*
|
|||||||
.ropeproject
|
.ropeproject
|
||||||
.codeintel
|
.codeintel
|
||||||
__pycache__
|
__pycache__
|
||||||
|
.venv/
|
||||||
|
build
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user