Skip to main content
remove superfluous import
Source Link
mbarkhau
  • 8.5k
  • 5
  • 33
  • 35

Werkzeug to the rescue!

from werkzeug.test import EnvironBuilder, run_wsgi_app from werkzeug.wrappers import Request  builder = EnvironBuilder(path='/v0/scenes/bucket/foo', method='POST', data={'image': (StringIO('fake image'), 'image.png')}, \ headers={'content-md5': 'some hash'}) env = builder.get_environ() (app_iter, status, headers) = run_wsgi_app(http.app.wsgi_app, env) status = int(status[:3]) # output will be something like 500 INTERNAL SERVER ERROR 

Werkzeug to the rescue!

from werkzeug.test import EnvironBuilder, run_wsgi_app from werkzeug.wrappers import Request  builder = EnvironBuilder(path='/v0/scenes/bucket/foo', method='POST', data={'image': (StringIO('fake image'), 'image.png')}, \ headers={'content-md5': 'some hash'}) env = builder.get_environ() (app_iter, status, headers) = run_wsgi_app(http.app.wsgi_app, env) status = int(status[:3]) # output will be something like 500 INTERNAL SERVER ERROR 

Werkzeug to the rescue!

from werkzeug.test import EnvironBuilder, run_wsgi_app builder = EnvironBuilder(path='/v0/scenes/bucket/foo', method='POST', data={'image': (StringIO('fake image'), 'image.png')}, \ headers={'content-md5': 'some hash'}) env = builder.get_environ() (app_iter, status, headers) = run_wsgi_app(http.app.wsgi_app, env) status = int(status[:3]) # output will be something like 500 INTERNAL SERVER ERROR 
Source Link
theicfire
  • 3.1k
  • 2
  • 30
  • 36

Werkzeug to the rescue!

from werkzeug.test import EnvironBuilder, run_wsgi_app from werkzeug.wrappers import Request builder = EnvironBuilder(path='/v0/scenes/bucket/foo', method='POST', data={'image': (StringIO('fake image'), 'image.png')}, \ headers={'content-md5': 'some hash'}) env = builder.get_environ() (app_iter, status, headers) = run_wsgi_app(http.app.wsgi_app, env) status = int(status[:3]) # output will be something like 500 INTERNAL SERVER ERROR