Skip to content

Commit

Permalink
[#54] Add test for Unicode pages
Browse files Browse the repository at this point in the history
  • Loading branch information
torfsen committed Sep 27, 2017
1 parent 467d7e2 commit b5ec387
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ckanext/pages/tests/test_logic.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# encoding: utf-8

from ckan.plugins import toolkit
from nose.tools import assert_in, assert_not_in
import ckan.model as model
Expand Down Expand Up @@ -68,3 +70,22 @@ def test_rendering_with_html_disallowed(self):
assert_in('<h1 class="page-heading">Disallowed</h1>', response.body)
assert_in('Test Link', response.body)
assert_not_in('<a href="/test">Test Link</a>', response.body)

def test_unicode(self):
env = {'REMOTE_USER': self.user['name'].encode('ascii')}
response = self.app.post(
url=toolkit.url_for('pages_edit', page='/test_unicode_page'),
params={
'title': u'Tïtlé'.encode('utf-8'),
'name': 'page_unicode',
'content': u'Çöñtéñt'.encode('utf-8'),
'order': 1,
'private': False,
},
extra_environ=env,
)
response = response.follow(extra_environ=env)
assert_in(u'<title>Tïtlé - CKAN</title>', response.unicode_body)
assert_in(u'<a href="/pages/page_unicode">Tïtlé</a>', response.unicode_body)
assert_in(u'<h1 class="page-heading">Tïtlé</h1>', response.unicode_body)
assert_in(u'<p>Çöñtéñt</p>', response.unicode_body)

0 comments on commit b5ec387

Please sign in to comment.