Skip to content

wrapp/txwebtest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebTest for Twisted

Inspired by WebTest for WSGI applications, txwebtest is an attempt to make life easier when testing Twisted web apps.

So far only the most basic functionality has been implemented. It has only been tested with Klein.

from klein import route, resource
from twisted.internet import defer, task
from txwebtest import TestClient

@route('/')
def home(request):
    return 'Hello, world!'

@defer.inlineCallbacks
def test_app():
    client = TestClient(resource())
    resp = yield client.get('/', status=200)
    assert resp.text == 'Hello, world!'

task.react(lambda reactor: test_app(), [])

About

WebTest for Twisted

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages