Skip to content

Commit

Permalink
Fix tests to run with zope.component >= 5.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz committed Mar 22, 2021
1 parent 96a8ae6 commit 0897441
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ CHANGES

- Drop support for Python 3.4.

- Fix tests to run with ``zope.component >= 5``.


4.0.1 (2017-05-15)
------------------
Expand Down
4 changes: 2 additions & 2 deletions src/zope/app/exception/browser/tests/test_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"""
import doctest
import unittest
from zope.component.interfaces import ComponentLookupError
from zope.app.exception.testing import AppExceptionLayer
from zope.app.exception.browser.tests import BrowserTestCase
from zope.app.exception.testing import AppExceptionLayer
from zope.app.wsgi.testlayer import http
from zope.interface.interfaces import ComponentLookupError


class RaiseError(object):
Expand Down
10 changes: 3 additions & 7 deletions src/zope/app/exception/browser/tests/test_unauthorized.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def testUnauthorized(self):
'no-store, no-cache, must-revalidate')

# Make sure the auth utility was called
self.failUnless(self.auth.request is request)
self.assertIs(self.auth.request, request)
self.assertEqual(self.auth.principal_id, 23)

def testRedirect(self):
Expand All @@ -112,19 +112,15 @@ def testRedirect(self):
res = u()

# Make sure that the template was not rendered
self.assert_(res is None)
self.assertIsNone(res)

# Make sure the auth's redirect is honored
self.assertEqual(request.response.getStatus(), 303)

# Make sure the auth utility was called
self.failUnless(self.auth.request is request)
self.assertIs(self.auth.request, request)
self.assertEqual(self.auth.principal_id, 23)


def test_suite():
return unittest.defaultTestLoader.loadTestsFromName(__name__)


if __name__ == '__main__':
unittest.main(defaultTest='test_suite')

0 comments on commit 0897441

Please sign in to comment.