<commit_before>from aleph.index import flush_index
from aleph.logic import delete_collection
from aleph.model import Collection
from aleph.tests.util import TestCase


class IndexTestCase(TestCase):

    def setUp(self):
        super(IndexTestCase, self).setUp()
        self.load_fixtures('docs.yaml')

    def test_delete_source(self):
        collection = Collection.by_id(1000)
        res = self.client.get('/api/2/query?q="mention fruit"')
        assert res.json['total'] == 1, res.json
        delete_collection(collection.id)
        flush_index()
        res = self.client.get('/api/2/query?q="mention fruit"')
        assert res.json['total'] == 0, res.json<commit_msg>fix up endpoint name.<commit_after>from aleph.index import flush_index
from aleph.logic import delete_collection
from aleph.model import Collection
from aleph.tests.util import TestCase


class IndexTestCase(TestCase):

    def setUp(self):
        super(IndexTestCase, self).setUp()
        self.load_fixtures('docs.yaml')

    def test_delete_source(self):
        collection = Collection.by_id(1000)
        res = self.client.get('/api/2/search?q="mention fruit"')
        assert res.json['total'] == 1, res.json
        delete_collection(collection.id)
        flush_index()
        res = self.client.get('/api/2/search?q="mention fruit"')
        assert res.json['total'] == 0, res.json
{'fraction_non_alphanumeric': 0.12317784256559766, 'fraction_numerical': 0.011661807580174927, 'mean_word_length': 3.358730158730159, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5686481', 'n_tokens_mistral': 426, 'n_tokens_neox': 407, 'n_words': 88}