#NEWLINE# @ patch ( 'open_connect.accounts.views.messages' ) #NEWLINE# def test_get_object_user_is_banned( self , mock_messages ) : #NEWLINE# #INDENT# 'should return the user and add a warning if user is banned.' #NEWLINE# user = mommy . make ( 'accounts.User' , is_banned = True ) #NEWLINE# view = views . UserDetailView ( ) #NEWLINE# view . request = self . request #NEWLINE# view . request . user = self . create_superuser ( ) #NEWLINE# view . kwargs = { #NEWLINE# #INDENT# 'user_uuid' : view . uuid , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( view . get_object ( ) , user ) #NEWLINE# self . assertEqual ( mock_messages . warning . call_args_list [ 0 ] [ 0 ] [ 1 ] , 'This is a banned account.' )