new_contents: from nose.tools import *  # PEP8 asserts
  from mock import patch
  from tests.base import OsfTestCase
  
  from website.search import share_search
  
  
  class TestShareSearch(OsfTestCase):
  
      @patch.object(share_search.share_es, 'search')
      def test_share_search(self, mock_search):
          mock_search.return_value = {
              'hits': {
                  'hits': {},
                  'total': 0
              }
          }
          self.app.get('/api/v1/share/', params={
              'q': '*',
              'from': '1',
              'size:': '20',
              'sort': 'date'
          })
          assert_is(mock_search.called, True)
  
      @patch.object(share_search.share_es, 'count')
      def test_share_count(self, mock_count):
          mock_count.return_value = {'count': 0}
          self.app.get('/api/v1/share/', params={
              'q': '*',
              'from': '1',
              'size:': '20',
              'sort': 'date',
              'count': True
          })
          assert_is(mock_count.called, True)
  
  
      @patch.object(share_search.share_es, 'search')
      def test_share_providers(self, mock_search):
          mock_search.return_value = {
              'hits': {
                  'hits': {},
                  'total': 0
              }
          }
          self.app.get('/api/v1/share/providers/')
          assert_is(mock_search.called, True)
  
      @patch.object(share_search.share_es, 'search')
      def test_share_stats(self, mock_search):
          mock_search.return_value = {
              'hits': {
                  'hits': {},
                  'total': 0
              },
              'aggregations': {
                  'date_chunks': {
                      'buckets': [{
                          'articles_over_time': {
                              'buckets': []
                          },
                          'key': 'test',
                          'doc_count': 0
                      }]
                  },
                  'sources': {
                      'buckets': [{
                          'key': 'test',
                          'doc_count': 0
                      }]
                  },
                  'earlier_documents': {
                      'sources': {
                          'buckets': [{
                              'key': 'test',
                              'doc_count': 0
                          }]
                      }
                  }
              }
          }
          self.app.get('/api/v1/share/stats/')
          assert_is(mock_search.called, True)
  
subject: Add tests for share view functions