#NEWLINE# def test_export_to_csv( self ) : #NEWLINE# #INDENT# expected_result = [ [ 'email' , 'name' ] , [ 'john@domain.com' , 'john' ] , [ 'alice@domain.com' , 'alice' ] , [ 'bob@domain.com' , 'bob' ] ] #NEWLINE# request = self . factory . get ( '/' ) #NEWLINE# queryset = Register . objects . all ( ) #NEWLINE# response = self . register_admin . export_to_csv ( expected_result , queryset ) #NEWLINE# self . assertEqual ( response . status_code , 200 ) #NEWLINE# csv_response = [ l . decode ( 'utf-8' ) . split ( ',' ) [ : 2 ] for l in response . content . splitlines ( ) ] #NEWLINE# self . assertEqual ( expected_result , csv_response )