Example #1
0
 def test_slugs_are_of_appropriate_size(self):
     """
     Artist slug must not exceed the specified length.
     """
     slug_length = 20
     artist = Artist(name='Some Artist')
     artist.save(slug_max_length=slug_length)
     self.assertLessEqual(len(artist.slug), slug_length)
Example #2
0
 def test_slugs_are_unique(self):
     """
     Artist slugs must be always unique, even when there are artists with
     the same name.
     """
     artist1 = create_artist()
     artist2 = Artist(name=artist1.name)
     artist2.save()
     self.assertNotEqual(artist1.slug, artist2.slug)
Example #3
0
def create_artist(name='Some Artist'):
    artist = Artist(name=name)
    artist.save()
    return artist