Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added some unit tests for deleting models using compound keys

  • Loading branch information...
commit 119fc7b81a09ca93b5da4c121c5a2095d6d6d15c 1 parent 489fb0d
Rob Vaterlaus authored
Showing with 17 additions and 0 deletions.
  1. +17 −0 tests/tests.py
View
17 tests/tests.py
@@ -625,6 +625,23 @@ def test_update_mismatched_id(self):
ckm.name = 'bar'
self.failUnlessRaises(DatabaseError, ckm.save)
+ def test_delete_by_id(self):
+ ckm = CompoundKeyModel(name='foo', index=6, extra='hello')
+ ckm.save();
+ ckm = CompoundKeyModel.objects.get(pk='foo|6')
+ ckm.delete()
+ qs = CompoundKeyModel.objects.all()
+ self.assertEqual(len(qs), 0)
+
+ def test_delete_by_fields(self):
+ ckm = CompoundKeyModel(name='foo', index=6, extra='hello')
+ ckm.save()
+ qs = CompoundKeyModel.objects.filter(name='foo', index=6)
+ qs.delete()
+ qs = CompoundKeyModel.objects.all()
+ self.assertEqual(len(qs), 0)
+
+
def test_custom_separator(self):
s = Slice(id='default')
s.save()
Please sign in to comment.
Something went wrong with that request. Please try again.