Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[master][1783][xs]: Avoid issue with foreign chars being passed into …
…hash function as unicode.
- Loading branch information
David Read
committed
Feb 7, 2012
1 parent
d1886ae
commit 8f059ed
Showing
2 changed files
with
17 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from nose.tools import assert_equals | ||
|
||
from ckan.lib.hash import get_message_hash, get_redirect | ||
|
||
class TestHash: | ||
@classmethod | ||
def setup_class(cls): | ||
global secret | ||
secret = '42' # so that these tests are repeatable | ||
|
||
def test_get_message_hash(self): | ||
assert_equals(get_message_hash(u'/tag/country-uk'), '6f58ff51b42e6b2d2e700abd1a14c9699e115c61') | ||
|
||
def test_get_message_hash_unicode(self): | ||
assert_equals(get_message_hash(u'/tag/biocombust\xedveis'), 'd748fa890eb6a964cd317e6ff62905fad645b43d') | ||
|