Skip to content

Commit

Permalink
Testing thumbor can decrypt a libthumbor url
Browse files Browse the repository at this point in the history
  • Loading branch information
heynemann committed Mar 31, 2011
1 parent 0e83fe9 commit 4d93b5c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions tests/test_libthumbor.py
Expand Up @@ -8,6 +8,9 @@
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 Bernardo Heynemann heynemann@gmail.com

import re
import hashlib

from thumbor.crypto import Crypto
from libthumbor import CryptoURL

Expand Down Expand Up @@ -54,6 +57,14 @@ def test_thumbor_can_decrypt_lib_thumbor_generated_url():
image_url=image
)

decrypted_url = thumbor_crypto.decrypt(url)
import ipdb;ipdb.set_trace()
assert url == thumbor_url
reg = "/([^/]+)/(.+)"
options = re.match(reg, url).groups()[0]

decrypted_url = thumbor_crypto.decrypt(options)

assert decrypted_url
assert decrypted_url['height'] == 200
assert decrypted_url['width'] == 300
assert decrypted_url['smart']
assert decrypted_url['image_hash'] == hashlib.md5(image).hexdigest()

0 comments on commit 4d93b5c

Please sign in to comment.