#NEWLINE# def test_awards_by_badge( self ) : #NEWLINE# #INDENT# 'Can view awards by badge' #NEWLINE# user = self . _get_user ( ) #NEWLINE# b1 = Badge . objects . create ( creator = user , title = 'Code Badge #1' ) #NEWLINE# u1 = self . _get_user ( username = 'tester1' ) #NEWLINE# u2 = self . _get_user ( username = 'tester2' ) #NEWLINE# u3 = self . _get_user ( username = 'tester3' ) #NEWLINE# for u in ( u1 , u2 , u3 ) : #NEWLINE# #INDENT# b1 . award_to ( u ) #NEWLINE# #UNINDENT# url = reverse ( 'badger.views.awards_by_badge' , args = ( b1 . slug , ) ) #NEWLINE# r = self . client . get ( url , follow = True ) #NEWLINE# doc = pq ( r . content ) #NEWLINE# eq_ ( 3 , doc . find ( '.award' ) . length ) #NEWLINE# for u in ( u1 , u2 , u3 ) : #NEWLINE# #INDENT# eq_ ( 1 , doc . find ( ( '.award .user:contains("%s")' % u . username ) ) . length )