Skip to content

Commit

Permalink
Improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed Oct 25, 2015
1 parent e43b15c commit 49dc2b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 1 addition & 3 deletions djangocms_blog/search_indexes.py
Expand Up @@ -17,8 +17,6 @@ class PostIndex(get_index_base()):
keywords = indexes.CharField(null=True)
tags = indexes.CharField(null=True)
post_text = indexes.CharField(null=True)
# category_ids = indexes.MultiValueField(null=True)
# category_titles = indexes.MultiValueField(null=True)

def get_keywords(self, post):
return ','.join(post.get_keywords())
Expand Down Expand Up @@ -54,7 +52,7 @@ def get_search_data(self, post, language, request):
text_bits = [post.get_title()]
text_bits.append(strip_tags(abstract))
text_bits.append(post.get_description())
# text_bits.append(' '.join(post.get_keywords()))
text_bits.append(' '.join(post.get_keywords()))
for category in post.categories.all():
text_bits.append(
force_text(category.safe_translation_getter('name')))
Expand Down
4 changes: 4 additions & 0 deletions tests/test_search.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from cms.api import add_plugin

from haystack.constants import DEFAULT_ALIAS
from haystack.query import SearchQuerySet
Expand All @@ -18,6 +19,9 @@ def test_blog_post_is_indexed_using_prepare(self):
"""This tests the indexing path way used by update_index mgmt command"""
post = self._get_post(self._post_data[0]['en'])
post = self._get_post(self._post_data[0]['it'], post, 'it')
post.tags.add('a tag')
add_plugin(post.content, 'Text', language='en', body='test body')

index = self.get_post_index()
index.index_queryset(DEFAULT_ALIAS) # initialises index._backend_alias
indexed = index.prepare(post)
Expand Down

0 comments on commit 49dc2b1

Please sign in to comment.