<s> from __future__ import unicode_literals <EOL> from django . db import IntegrityError <EOL> from django . test import TestCase <EOL> from . . models import Badge , Award <EOL> from . mixins import UserFixturesMixin <EOL> class BadgeTestCase ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_autocreate_slug ( self ) : <EOL> badge = Badge . objects . create ( name = '<STR_LIT>' ) <EOL> self . assertEqual ( badge . slug , '<STR_LIT>' ) <EOL> class AwardTestCase ( TestCase , UserFixturesMixin ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> self . create_users ( ) <EOL> def test_create ( self ) : <EOL> badge = Badge . objects . create ( name = '<STR_LIT>' ) <EOL> Award . objects . create ( user = self . user1 , badge = badge ) <EOL> Award . objects . create ( user = self . user2 , badge = badge ) <EOL> self . assertEqual ( badge . users . count ( ) , <NUM_LIT:2> ) <EOL> self . assertRaises ( IntegrityError , Award . objects . create , ** { <EOL> '<STR_LIT:user>' : self . user1 , <EOL> '<STR_LIT>' : badge <EOL> } ) </s>
