Skip to content

Commit

Permalink
Rename test classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
florianpilz committed Sep 30, 2016
1 parent d08e7bf commit dcaf82b
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/zope/testbrowser/tests/test_wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def make_wsgi_app(self):
SIMPLE_LAYER = SimpleLayer()


class WSGILayer(object):
class AppLayer(object):

def make_wsgi_app(self):
return demo_app
Expand All @@ -43,11 +43,11 @@ def testTearDown(self):
pass


class SimpleWSGILayer(zope.testbrowser.wsgi.TestBrowserLayer, WSGILayer):
class TestBrowserLayer(zope.testbrowser.wsgi.TestBrowserLayer, AppLayer):

pass

SIMPLE_WSGI_LAYER = SimpleWSGILayer()
TEST_BROWSER_LAYER = TestBrowserLayer()


class TestBrowser(unittest.TestCase):
Expand Down Expand Up @@ -235,9 +235,9 @@ class TestTestBrowserLayer(unittest.TestCase):

@contextlib.contextmanager
def wsgi_layer(self):
SIMPLE_WSGI_LAYER.testSetUp()
TEST_BROWSER_LAYER.testSetUp()
yield
SIMPLE_WSGI_LAYER.testTearDown()
TEST_BROWSER_LAYER.testTearDown()

def test_layer(self):
"""When the layer is setup, the wsgi_app argument is unnecessary"""
Expand All @@ -248,17 +248,17 @@ def test_layer(self):

def test_there_can_only_be_one(self):
with self.wsgi_layer():
another_layer = SimpleWSGILayer()
another_layer = TestBrowserLayer()
self.assertRaises(AssertionError, another_layer.testSetUp)

def test_supports_multiple_inheritance(self):
with mock.patch('zope.testbrowser.tests.test_wsgi'
'.WSGILayer.testSetUp') as testSetUp:
SIMPLE_WSGI_LAYER.testSetUp()
'.AppLayer.testSetUp') as testSetUp:
TEST_BROWSER_LAYER.testSetUp()
self.assertEqual(1, testSetUp.call_count)
with mock.patch('zope.testbrowser.tests.test_wsgi'
'.WSGILayer.testTearDown') as testTearDown:
SIMPLE_WSGI_LAYER.testTearDown()
'.AppLayer.testTearDown') as testTearDown:
TEST_BROWSER_LAYER.testTearDown()
self.assertEqual(1, testTearDown.call_count)

def test_raise_error_when_make_wsgi_app_is_not_implemented(self):
Expand All @@ -267,10 +267,10 @@ def test_raise_error_when_make_wsgi_app_is_not_implemented(self):

def test_do_not_raise_error_when_make_wsgi_app_returns_None(self):
with mock.patch('zope.testbrowser.tests.test_wsgi'
'.WSGILayer.make_wsgi_app') as make_wsgi_app:
'.AppLayer.make_wsgi_app') as make_wsgi_app:
make_wsgi_app.return_value = None
SIMPLE_WSGI_LAYER.testSetUp()
SIMPLE_WSGI_LAYER.testTearDown()
TEST_BROWSER_LAYER.testSetUp()
TEST_BROWSER_LAYER.testTearDown()


class TestAuthorizationMiddleware(unittest.TestCase):
Expand Down

0 comments on commit dcaf82b

Please sign in to comment.