Skip to content

Commit

Permalink
add test to reproduce error with query string
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhess committed Jul 7, 2015
1 parent 9119e2b commit 64a9ebf
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion vows/handler_images_vows.py
Expand Up @@ -14,6 +14,7 @@
import tempfile

from pyvows import Vows, expect
from mock import Mock
from tornado_pyvows.context import TornadoHTTPContext

from thumbor.app import ThumborServiceApp
Expand All @@ -22,7 +23,7 @@
from thumbor.context import Context, ServerParameters
from thumbor.engines.pil import Engine as PILEngine
from thumbor.storages.file_storage import Storage as FileStorage
from thumbor.utils import which
from thumbor.utils import which, logger

storage_path = abspath(join(dirname(__file__), 'fixtures/'))

Expand Down Expand Up @@ -254,10 +255,13 @@ def get_app(self):
ctx = Context(server, cfg, importer)
application = ThumborServiceApp(ctx)

logger.exception = Mock()

storage = FileStorage(Context(config=cfg, server=server))

# Store fixtures (image.jpg and image.txt) into the file storage
storage.put('image.jpg', open(join(storage_path, 'image.jpg')).read())
storage.put('image.jpg?ts=1', open(join(storage_path, 'image.jpg')).read())
storage.put_crypto('image.jpg') # Write a file on the file storage containing the security key

return application
Expand All @@ -271,6 +275,17 @@ def should_be_200(self, response):
code, _ = response
expect(code).to_equal(200)

class WithRegularImageWithQueryString(TornadoHTTPContext):
def topic(self):
response = self.get('/R89X0rx7cnbYfTTxSRJQ1CItKzY=/smart/image.jpg?ts=1')
return (response.code, response.headers)

def should_be_200(self, response):
code, _ = response
expect(code).to_equal(200)

def should_not_log_exception(self, response):
expect(logger.exception.called).to_be_false()

@Vows.batch
class GetImageWithAutoWebP(BaseContext):
Expand Down

0 comments on commit 64a9ebf

Please sign in to comment.