Skip to content

Conversation

@oceanites
Copy link

I tried to test my application using boddle and stumpled upon two problems:

  • As @signalw mentioned in throw error if 'environ' in extra arg. remove extra_orig. #7: forms is not testable
  • I'm using beaker for session handling and tried to add the data using the extra args:
    • boddle(beaker.session='session') obviously doesn't work (It tries to access attribute session from a not existing beaker object), as well as boddle('beaker.session'='session')
    • When providing it as a dictionary boddle(**{'beaker.session': 'session'}), the value is stored in bottle.request.ext.beaker.session and therefore, only accessible with getattr(bottle.request, 'beaker.session')

To solve this issue i propose adding an extra argument environ for the context manager. This solves both issues, forms can be preset with boddle(environ={'bottle.request.forms': formdata}). Beaker session data using boddle(environ={'beaker.session': sessiondata}).

@Marrin
Copy link

Marrin commented Sep 26, 2019

This seems also be useful/needed to test routes with Basic Auth to set the REMOTE_USER environment variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants