<commit_before>import json
from datetime import datetime

from django.contrib.auth.models import User

from mock import Mock, patch
from nose.tools import eq_, ok_

import amo
import mkt.regions
from addons.models import (AddonCategory, AddonDeviceType, AddonUpsell,
                           Category)
from amo.tests import app_factory, ESTestCase
from stats.models import ClientData
from users.models import UserProfile

from mkt.api.base import list_url
from mkt.api.models import Access, generate
from mkt.api.tests.test_oauth import BaseOAuth, OAuthClient
from mkt.constants.features import FeatureProfile
from mkt.search.forms import DEVICE_CHOICES_IDS
from mkt.search.views import _get_query
from mkt.site.fixtures import fixture
from mkt.webapps.models import Installed, Webapp


@patch('versions.models.Version.is_privileged', False)
class TestApi(BaseOAuth, ESTestCase):
    fixtures = fixture('webapp_337141')

    def setUp(self):
        super(TestApi, self).setUp()
        self.client = OAuthClient(None)
        self.url = list_url('search')
        self.webapp = Webapp.objects.get(pk=337141)
        self.category = Category.objects.create(name='test',
                                                type=amo.ADDON_WEBAPP)
        self.webapp.save()
        self.refresh('webapp')

    def test_verbs(self):
        self._allowed_verbs(self.url, ['get'])

    def test_has_cors(self):
        self.assertCORS(self.client.get(self.url), 'get')

    def test_meta(self):<commit_msg>Fixed search tests<commit_after>import json
from datetime import datetime

from django.contrib.auth.models import User

from mock import Mock, patch
from nose.tools import eq_, ok_

import amo
import mkt.regions
from addons.models import (AddonCategory, AddonDeviceType, AddonUpsell,
                           Category)
from amo.tests import app_factory, ESTestCase
from stats.models import ClientData
from users.models import UserProfile

from mkt.api.base import list_url
from mkt.api.models import Access, generate
from mkt.api.tests.test_oauth import BaseOAuth, OAuthClient
from mkt.constants.features import FeatureProfile
from mkt.search.forms import DEVICE_CHOICES_IDS
from mkt.search.views import _get_query
from mkt.site.fixtures import fixture
from mkt.webapps.models import Installed, Webapp


@patch('versions.models.Version.is_privileged', False)
class TestApi(BaseOAuth, ESTestCase):
    fixtures = fixture('webapp_337141')

    def setUp(self):
        self.client = OAuthClient(None)
        self.url = list_url('search')
        self.webapp = Webapp.objects.get(pk=337141)
        self.category = Category.objects.create(name='test',
                                                type=amo.ADDON_WEBAPP)
        self.webapp.save()
        self.refresh('webapp')

    def test_verbs(self):
        self._allowed_verbs(self.url, ['get'])

    def test_has_cors(self):
        self.assertCORS(self.client.get(self.url), 'get')

    def test_meta(self):
{'fraction_non_alphanumeric': 0.08827493261455525, 'fraction_numerical': 0.008086253369272238, 'mean_word_length': 3.418154761904762, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3839158', 'n_tokens_mistral': 921, 'n_tokens_neox': 888, 'n_words': 221}