Skip to content

Instantly share code, notes, and snippets.

@mekhami
Created October 22, 2015 15:28
Show Gist options
  • Select an option

  • Save mekhami/2a03ab02486cb4dfc2a3 to your computer and use it in GitHub Desktop.

Select an option

Save mekhami/2a03ab02486cb4dfc2a3 to your computer and use it in GitHub Desktop.
def test_colection_uniqueness(self):
collection = CollectionFactory()
collection2 = CollectionFactory()
collection.site = 'foo'
collection.slug = 'foo'
collection2.site = 'foo'
collection2.site = 'foo'
collection.save()
with self.assertRaises(ValidationError):
collection2.save()
collection2.site = 'bar'
# No longer throws a Validation error.
collection2.slug = 'bar'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment