#NEWLINE# def test_awards_by_user( self ) : #NEWLINE# #INDENT# 'Can view awards by user' #NEWLINE# user = self . _get_user ( ) #NEWLINE# user2 = self . _get_user ( username = 'tester2' ) #NEWLINE# ( b1 , created ) = Badge . objects . get_or_create ( creator = user , title = 'Code Badge #1' ) #NEWLINE# ( b2 , created ) = Badge . objects . get_or_create ( creator = user , title = 'Code Badge #2' ) #NEWLINE# ( b3 , created ) = Badge . objects . get_or_create ( creator = user , title = 'Code Badge #3' ) #NEWLINE# b1 . award_to ( user2 ) #NEWLINE# award_badge ( b2 . slug , user2 ) #NEWLINE# Award . objects . create ( badge = b3 , user = user2 ) #NEWLINE# url = reverse ( 'badger.views.awards_by_user' , args = ( user2 . username , ) ) #NEWLINE# r = self . client . get ( url , follow = True ) #NEWLINE# doc = pq ( r . content ) #NEWLINE# eq_ ( 'badge_awards_by_user' , doc . find ( 'body' ) . attr ( 'id' ) ) #NEWLINE# eq_ ( 3 , doc . find ( '.badge' ) . length ) #NEWLINE# for b in ( b1 , b2 , b3 ) : #NEWLINE# #INDENT# eq_ ( 1 , doc . find ( ( '.badge .title:contains("%s")' % b . title ) ) . length )