python - Route testing with Tornado -


i'm new tornado, , working on project involves rather complex routing. in of other frameworks i've used i've been able isolate routing testing, without spinning server or doing terribly complex. i'd prefer use pytest testing framework, i'm not sure matters.

is there way to, say, create project's instance of tornado.web.application, , pass arbitrary paths , assert requesthandler invoked based on path?

no, not possible test in tornado via public interface (as of tornado version 4.3).

it's straightforward avoid spinning server, although requires nontrivial amount of code: interface between httpserver , application well-defined , documented. trickier part other side: there no supported way determine handler invoked before handler is invoked.

i recommend testing routing via end-to-end tests reason. store url route list before passing tornado, , tests against - internal logic of "take first regex match" pretty easy replicate.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -