<commit_before>from nose.tools import *  # PEP8 asserts
from mock import patch
from tests.base import OsfTestCase
import xml

from website.search import share_search

STANDARD_RETURN_VALUE = {
    'hits': {
        'hits': [{
            "_score": 1,
            "_type": "doepages",
            "_id": "1164135",
            "_source": {
                "description": "We calculate the masses of baryons containing one, two, or three heavy quarks using lattice QCD. We consider all possible combinations of charm and bottom and quark-model studies.",
                "contributors": [{
                    "given": "Zachary",
                    "suffix": "",
                    "family": "Brown",
                    "middle": "S.",
                    "prefix": "",
                    "ORCID": "",
                    "email": ""
                }],
                "title": "Charmed bottom baryon spectroscopy from lattice QCD",
                "source": "doepages",
                "dateUpdated": "2014-11-24T00:00:00",
                "id": {
                    "url": "http://www.osti.gov/pages/biblio/1164135",
                    "serviceID": "1164135",
                    "doi": "10.1103/PhysRevD.90.094507"
                },
                "tags": []
            },
            "_index": "share"
        }, {
            "_score": 1,
            "_type": "doepages",
            "_id": "1164539",
            "_source": {
                "description": "",
                "contributors": [{
                    "given": "Peng",
                    "suffix": "",
                    "family": "Lian",
                    "middle": "",
                    "prefix": "",
                    "ORCID": "",
                    "email": ""
                }],
                "source": "doepages",
                "dateUpdated": "2014-11-27T00:00:00",
                "id": {
                    "url": "http://www.osti.gov/pages/biblio/1164539",
                    "serviceID": "1164539",
                    "doi": "10.1021/bi500608u"
                },
                "tags": []
            },
            "_index": "share"
        }],
        'total': 2
    }
}


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<commit_msg>Changed the mock data to be way less real<commit_after>from nose.tools import *  # PEP8 asserts
from mock import patch
from tests.base import OsfTestCase
import xml

from website.search import share_search

STANDARD_RETURN_VALUE = {
    'hits': {
        'hits': [{
            "_score": 1,
            "_type": "squaredcircle",
            "_id": "1164135",
            "_source": {
                "description": "Jobbers and society.",
                "contributors": [{
                    "given": "Zachary",
                    "suffix": "",
                    "family": "Ryder",
                    "middle": "Woo Woo Woo",
                    "prefix": "",
                    "ORCID": "",
                    "email": ""
                }],
                "title": "Am I Still Employed",
                "source": "squaredcircle",
                "dateUpdated": "2014-11-24T00:00:00",
                "id": {
                    "url": "http://squaredcircle.com/zackryder/woowoowoo",
                    "serviceID": "123456",
                    "doi": "10.123/wrestlingDOIs"
                },
                "tags": ['woo', 'woo', 'woo'],
            },
            "_index": "share"
        }, {
            "_score": 1,
            "_type": "squaredcircle",
            "_id": "1164539",
            "_source": {
                "description": "Unlocking the universe with the Cosmic Key",
                "contributors": [{
                    "given": "Star",
                    "suffix": "",
                    "family": "Dust",
                    "middle": "",
                    "prefix": "",
                    "ORCID": "",
                    "email": ""
                }],
                "source": "squaredcircle",
                "dateUpdated": "2014-11-27T00:00:00",
                "id": {
                    "url": "http://squaredcircle.com/stardust/hisssssss",
                    "serviceID": "12346",
                    "doi": "10.123/wrestlingDOIs"
                },
                "tags": ['cody', 'is', 'noone']
            },
            "_index": "share"
        }],
        'total': 2
    }
}


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
{'fraction_non_alphanumeric': 0.14486754966887416, 'fraction_numerical': 0.034975165562913905, 'mean_word_length': 1.151825467497774, 'pattern_counts': {'":': 86, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3351524', 'n_tokens_mistral': 1492, 'n_tokens_neox': 1263, 'n_words': 268}