@@ -20,4 +20,4 @@ limitations under the License.
|
||||
from falcon.testing.helpers import * # NOQA
|
||||
from falcon.testing.srmock import StartResponseMock # NOQA
|
||||
from falcon.testing.test_resource import TestResource # NOQA
|
||||
from falcon.testing.test_suite import TestSuite # NOQA
|
||||
from falcon.testing.base import TestBase # NOQA
|
||||
@@ -19,11 +19,11 @@ limitations under the License.
|
||||
import testtools
|
||||
|
||||
import falcon
|
||||
from .srmock import StartResponseMock
|
||||
from .helpers import create_environ
|
||||
from falcon.testing.srmock import StartResponseMock
|
||||
from falcon.testing.helpers import create_environ
|
||||
|
||||
|
||||
class TestSuite(testtools.TestCase):
|
||||
class TestBase(testtools.TestCase):
|
||||
"""Scaffolding around testtools.TestCase for testing a Falcon API endpoint.
|
||||
|
||||
Inherit from this and write your test methods. If the child class defines
|
||||
@@ -44,7 +44,7 @@ class TestSuite(testtools.TestCase):
|
||||
def setUp(self):
|
||||
"""Initializer, unittest-style"""
|
||||
|
||||
super(TestSuite, self).setUp()
|
||||
super(TestBase, self).setUp()
|
||||
self.api = falcon.API()
|
||||
self.srmock = StartResponseMock()
|
||||
self.test_route = '/' + self.getUniqueString()
|
||||
@@ -60,7 +60,7 @@ class TestSuite(testtools.TestCase):
|
||||
if hasattr(after, '__call__'):
|
||||
after()
|
||||
|
||||
super(TestSuite, self).tearDown()
|
||||
super(TestBase, self).tearDown()
|
||||
|
||||
def simulate_request(self, path, **kwargs):
|
||||
""" Simulates a request.
|
||||
@@ -59,7 +59,7 @@ class ZooResource(object):
|
||||
self.resp = resp
|
||||
|
||||
|
||||
class TestHooks(testing.TestSuite):
|
||||
class TestHooks(testing.TestBase):
|
||||
|
||||
def before(self):
|
||||
self.resource = WrappedRespondersResource()
|
||||
|
||||
@@ -91,7 +91,7 @@ class ZooResource(object):
|
||||
self.frogs = frogs
|
||||
|
||||
|
||||
class TestHooks(testing.TestSuite):
|
||||
class TestHooks(testing.TestBase):
|
||||
|
||||
def before(self):
|
||||
self.resource = WrappedRespondersResource()
|
||||
|
||||
@@ -87,7 +87,7 @@ class VaryHeaderResource:
|
||||
resp.vary = self.vary
|
||||
|
||||
|
||||
class TestHeaders(testing.TestSuite):
|
||||
class TestHeaders(testing.TestBase):
|
||||
|
||||
def before(self):
|
||||
self.resource = testing.TestResource()
|
||||
|
||||
@@ -49,7 +49,7 @@ class NoStatusResource:
|
||||
pass
|
||||
|
||||
|
||||
class TestHelloWorld(testing.TestSuite):
|
||||
class TestHelloWorld(testing.TestBase):
|
||||
|
||||
def before(self):
|
||||
self.resource = HelloResource('body')
|
||||
|
||||
@@ -69,7 +69,7 @@ class ResourceGetWithParam(object):
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
||||
class TestHttpMethodRouting(testing.TestSuite):
|
||||
class TestHttpMethodRouting(testing.TestBase):
|
||||
|
||||
def before(self):
|
||||
self.resource_get = ResourceGet()
|
||||
|
||||
@@ -79,7 +79,7 @@ class ServiceUnavailableResource:
|
||||
raise falcon.HTTPServiceUnavailable('Oops', 'Stand by...', 60)
|
||||
|
||||
|
||||
class TestHTTPError(testing.TestSuite):
|
||||
class TestHTTPError(testing.TestBase):
|
||||
|
||||
def before(self):
|
||||
self.resource = FaultyResource()
|
||||
|
||||
@@ -2,7 +2,7 @@ import falcon
|
||||
import falcon.testing as testing
|
||||
|
||||
|
||||
class TestQueryParams(testing.TestSuite):
|
||||
class TestQueryParams(testing.TestBase):
|
||||
|
||||
def before(self):
|
||||
self.resource = testing.TestResource()
|
||||
|
||||
@@ -2,7 +2,7 @@ from falcon.request import Request
|
||||
import falcon.testing as testing
|
||||
|
||||
|
||||
class TestReqVars(testing.TestSuite):
|
||||
class TestReqVars(testing.TestBase):
|
||||
|
||||
def before(self):
|
||||
qs = '?marker=deadbeef&limit=10'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import falcon.testing as testing
|
||||
|
||||
|
||||
class TestRequestBody(testing.TestSuite):
|
||||
class TestRequestBody(testing.TestBase):
|
||||
|
||||
def before(self):
|
||||
self.resource = testing.TestResource()
|
||||
|
||||
@@ -13,7 +13,7 @@ class IDResource(object):
|
||||
self.called = True
|
||||
|
||||
|
||||
class TestUriTemplates(testing.TestSuite):
|
||||
class TestUriTemplates(testing.TestBase):
|
||||
|
||||
def before(self):
|
||||
self.resource = testing.TestResource()
|
||||
|
||||
@@ -20,7 +20,7 @@ class LoggerResource:
|
||||
req.log_error(str_message)
|
||||
|
||||
|
||||
class TestWSGIError(testing.TestSuite):
|
||||
class TestWSGIError(testing.TestBase):
|
||||
|
||||
def before(self):
|
||||
self.tehlogger = LoggerResource()
|
||||
|
||||
Reference in New Issue
Block a user