Skip to content

Commit

Permalink
tests: patch render_template_to_string
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
  • Loading branch information
jirikuncar committed Oct 2, 2015
1 parent dc19422 commit e0e4833
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
7 changes: 3 additions & 4 deletions invenio_search/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
from werkzeug.utils import import_string

from invenio_base.globals import cfg
from invenio_collections.cache import (
get_collection_allchildren,
restricted_collection_cache,
)


def get_most_popular_field_values(recids, tags, exclude_values=None,
Expand Down Expand Up @@ -135,6 +131,9 @@ def get_permitted_restricted_collections(user_info,
recreate_cache_if_needed=True):
"""Return a list of restricted collection with user is authorization."""
from invenio_access.engine import acc_authorize_action
from invenio_collections.cache import (
restricted_collection_cache,
)

if recreate_cache_if_needed:
restricted_collection_cache.recreate_cache_if_needed()
Expand Down
1 change: 1 addition & 0 deletions requirements-devel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
-e git+git://github.com/inveniosoftware/invenio-access.git#egg=invenio-access
-e git+git://github.com/inveniosoftware/invenio-accounts.git#egg=invenio-accounts
-e git+git://github.com/inveniosoftware/invenio-base.git#egg=invenio-base
-e git+git://github.com/inveniosoftware/invenio-collections.git#egg=invenio-collections
-e git+git://github.com/inveniosoftware/invenio-ext.git#egg=invenio-ext
-e git+git://github.com/inveniosoftware/invenio-formatter.git#egg=invenio-formatter
-e git+git://github.com/inveniosoftware/invenio-knowledge.git#egg=invenio-knowledge
Expand Down
11 changes: 6 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,20 @@
'invenio-formatter>=0.2.1',
'invenio-knowledge>=0.1.0',
'invenio-query-parser>=0.3.0',
'invenio-utils>=0.1.1',
'invenio-upgrader>=0.1.2',
'invenio-utils>=0.1.1',
'six>=1.7.2',
]

test_requirements = [
'unittest2>=1.1.0',
'Flask_Testing>=0.4.1',
'pytest>=2.8.0',
'pytest-cov>=2.1.0',
'pytest-pep8>=1.0.6',
'coverage>=4.0.0',
'invenio-collections>=0.1.2',
'invenio-testing>=0.1.1',
'pytest-cov>=2.1.0',
'pytest-pep8>=1.0.6',
'pytest>=2.8.0',
'unittest2>=1.1.0',
]


Expand Down
8 changes: 6 additions & 2 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@

from flask import current_app, url_for

from mock import patch

from invenio_testing import InvenioTestCase


class SearchViewTest(InvenioTestCase):

""" Test search view functions. """
"""Test search view functions."""

render_templates = False

Expand All @@ -38,6 +40,8 @@ def test_home_collection_page_availability(self):
'collections.collection', name=current_app.config['CFG_SITE_NAME']))
self.assert200(response)

def test_search_page_availability(self):
@patch('invenio_search.views.search.response_formated_records')
def test_search_page_availability(self, response_formated_records_patch):
response_formated_records_patch.return_value = ''
response = self.client.get(url_for('search.search'))
self.assert200(response)

0 comments on commit e0e4833

Please sign in to comment.