Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'test_improvments' of git://github.com/fivethreeo/django…
…-cms into test_improvements
- Loading branch information
Showing
22 changed files
with
248 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,4 +33,4 @@ def test_01_html(self): | |
app.build() | ||
except: | ||
print nullout.getvalue() | ||
raise | ||
raise |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from cms.middleware.multilingual import patch_response | ||
from django.core.urlresolvers import reverse | ||
from django.test.testcases import TestCase | ||
import urllib | ||
|
||
|
||
class MultilingualTestCase(TestCase): | ||
def test_01_multilingual_url_middleware(self): | ||
""" | ||
Test the Multilingual URL Middleware correctly handles the various ways | ||
one can write URLs in HTML. | ||
""" | ||
# stuff we need | ||
pages_root = urllib.unquote(reverse('pages-root')) | ||
language = "en" | ||
# single quoted a tag | ||
content = "<a href='/url/'>" | ||
output = patch_response(content, pages_root, language) | ||
expected = "<a href='/en/url/'>" | ||
self.assertEqual(output, expected) | ||
# double quoted a tag | ||
content = '<a href="/url/">' | ||
output = patch_response(content, pages_root, language) | ||
expected = '<a href="/en/url/">' | ||
self.assertEqual(output, expected) | ||
# single quoted a tag with a class and rel attribute | ||
content = "<a rel='rel' href='/url/' class='cms'>" | ||
output = patch_response(content, pages_root, language) | ||
expected = "<a rel='rel' href='/en/url/' class='cms'>" | ||
self.assertEqual(output, expected) | ||
# single quoted form tag | ||
content = "<form action='/url/'>" | ||
output = patch_response(content, pages_root, language) | ||
expected = "<form action='/en/url/'>" | ||
self.assertEqual(output, expected) | ||
# double quoted form tag | ||
content = '<form action="/url/">' | ||
output = patch_response(content, pages_root, language) | ||
expected = '<form action="/en/url/">' | ||
self.assertEqual(output, expected) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.