def test_action_return_csv_content(self):
     """ Test method return csv content """
     user_admin = UserAdmin(User, self.site)
     response = user_admin.export_email(request=MockRequest(),
                                        queryset=self.query_set)
     output = io.StringIO()
     writer = csv.writer(output)
     for email in User.objects.values_list('email'):
         writer.writerow(email)
     self.assertEqual(response.content.decode(), output.getvalue())
 def test_action_return_csv(self):
     """ Test method return text/csv as http response content type """
     user_admin = UserAdmin(User, self.site)
     response = user_admin.export_email(request=MockRequest(),
                                        queryset=self.query_set)
     self.assertEqual(response.get('Content-Type'), 'text/csv')
 def test_action_return_http_response(self):
     """ Test method return an HttpResponse """
     user_admin = UserAdmin(User, self.site)
     response = user_admin.export_email(request=MockRequest(),
                                        queryset=self.query_set)
     self.assertIsInstance(response, HttpResponse)