Commit ec11e9f9 authored by Michal Čihař's avatar Michal Čihař

Test for search id browsing

parent 149dc138
...@@ -29,6 +29,7 @@ from django.contrib.messages.storage.fallback import FallbackStorage ...@@ -29,6 +29,7 @@ from django.contrib.messages.storage.fallback import FallbackStorage
from trans.tests.models import RepoTestCase from trans.tests.models import RepoTestCase
from accounts.models import Profile from accounts.models import Profile
import cairo import cairo
import re
from urlparse import urlsplit from urlparse import urlsplit
from cStringIO import StringIO from cStringIO import StringIO
...@@ -324,3 +325,32 @@ class SearchViewTest(ViewTestCase): ...@@ -324,3 +325,32 @@ class SearchViewTest(ViewTestCase):
response, response,
self.translation.get_absolute_url() self.translation.get_absolute_url()
) )
def test_search_links(self):
response = self.client.get(
self.translate_url,
{'q': 'weblate'}
)
self.assertContains(
response,
'Current filter: Fulltext search for'
)
# Extract search ID
search_id = re.findall(r'sid=([0-9a-f-]*)&amp', response.content)[0]
# Try access to pages
response = self.client.get(
self.translate_url,
{'sid': search_id, 'offset': 0}
)
self.assertContains(
response,
'http://demo.weblate.org/',
)
response = self.client.get(
self.translate_url,
{'sid': search_id, 'offset': 1}
)
self.assertContains(
response,
'Thank you for using Weblate.',
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment