reinforced test for BinaryField being a Primary Key

This commit is contained in:
mrigal 2015-04-11 01:54:05 +02:00 committed by Matthieu Rigal
parent 0a65006bb4
commit a5c2fc4f9d

View File

@ -2488,10 +2488,11 @@ class FieldTest(unittest.TestCase):
id = BinaryField(primary_key=True) id = BinaryField(primary_key=True)
Attachment.drop_collection() Attachment.drop_collection()
binary_id = uuid.uuid4().bytes
att = Attachment(id=uuid.uuid4().bytes).save() att = Attachment(id=binary_id).save()
self.assertEqual(1, Attachment.objects.count())
self.assertIsNotNone(Attachment.objects.filter(id=binary_id).first())
att.delete() att.delete()
self.assertEqual(0, Attachment.objects.count()) self.assertEqual(0, Attachment.objects.count())
def test_choices_validation(self): def test_choices_validation(self):