testing advice sought - external callback/hook

30 views
Skip to first unread message

Jonathan Vanasco

unread,
Jun 6, 2016, 7:22:47 PM6/6/16
to pylons-discuss
I'm open-sourcing a pyramid-based client for the LetsEncrypt https certificate service, and have run into an issue with the tests.

All the tests are written using webtest, specifically TestApp.

On one specific test, after stepping through a form, I need to receive a web request from the LetsEncrypt test server.

Does anyone know if it is possible to somehow bind an existing TestApp() instance to a port, or if there is a way to leverage webtest.http with an existing TestApp instance?

Mikko Ohtamaa

unread,
Jun 6, 2016, 9:35:15 PM6/6/16
to pylons-...@googlegroups.com

On one specific test, after stepping through a form, I need to receive a web request from the LetsEncrypt test server.

Does anyone know if it is possible to somehow bind an existing TestApp() instance to a port, or if there is a way to leverage webtest.http with an existing TestApp instance?


Here is an example how to create a test web server for WSGI app (Pyramid):

https://github.com/websauna/websauna/blob/master/websauna/tests/webserver.py#L14

Note that it works with Pyramid WSGI app, not TestApp. TestApp itself wraps the underlying WSGI app.

-Mikko
 

--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discus...@googlegroups.com.
To post to this group, send email to pylons-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/1d24d89a-ca55-4353-a0e1-1f9842e24016%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Jonathan Vanasco

unread,
Jun 7, 2016, 12:13:37 AM6/7/16
to pylons-discuss
thanks so much!  this worked based on your example!:

    def tearDown(self):
        if self.testapp_http is not None:
            self.testapp_http.shutdown()

    def test_foo(self):
        self.testapp_http = StopableWSGIServer.create(self.testapp.app)
        self.testapp_http.wait()
        res = self.testapp.get('/foo')
        
Reply all
Reply to author
Forward
0 new messages