예제 #1
0
    def setUp(self):
        super(UUIDPrimaryKeyModelTests, self).setUp()

        # Multiple objects are generated in order to test the auto-generation and
        # uniqueness features of the UUID field.
        for i in range(0, INSTANCE_COUNT):
            obj = UUIDPrimaryKeyModel()
            obj.save()
예제 #2
0
  def setUp(self):
    super(UUIDPrimaryKeyModelTests, self).setUp()

    # Multiple objects are generated in order to test the auto-generation and
    # uniqueness features of the UUID field.
    for i in range(0, INSTANCE_COUNT):
      obj = UUIDPrimaryKeyModel()
      obj.save()
예제 #3
0
 def test_uuid_is_unique(self):
     """Tests that two UUIDPrimaryKeyModel objects cannot be created with the
 same UUID value."""
     obj = UUIDPrimaryKeyModel.objects.filter()[0]
     new_obj = UUIDPrimaryKeyModel()
     new_obj.id = obj.id
     self.assertRaisesRegexp(
         django.core.exceptions.ValidationError,
         u'with this Universally unique identifier already exists',
         new_obj.validate_unique,
     )
예제 #4
0
 def test_uuid_is_unique(self):
   """Tests that two UUIDPrimaryKeyModel objects cannot be created with the
   same UUID value."""
   obj = UUIDPrimaryKeyModel.objects.filter()[0]
   new_obj = UUIDPrimaryKeyModel()
   new_obj.id = obj.id
   self.assertRaisesRegexp(
     django.core.exceptions.ValidationError,
     u'with this Universally unique identifier already exists',
     new_obj.validate_unique,
   )