• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zopefoundation / zope.app.applicationcontrol / 5567537576

pending completion
5567537576

push

github

web-flow
Config with pure python template (#7)

* Drop support for Python 2.7, 3.5, 3.6.
* Add support for Python 3.11.

65 of 65 branches covered (100.0%)

Branch coverage included in aggregate %.

441 of 441 relevant lines covered (100.0%)

1.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/zope/app/applicationcontrol/browser/tests/__init__.py
1
import unittest
1✔
2

3
from webtest import TestApp
1✔
4
from zope.component import getUtility
1✔
5
from zope.error.interfaces import IErrorReportingUtility
1✔
6
from zope.publisher.browser import BrowserView
1✔
7
from zope.traversing.browser.absoluteurl import absoluteURL
1✔
8

9
from zope.app.applicationcontrol.testing import ApplicationControlLayer
1✔
10

11

12
class BrowserTestCase(unittest.TestCase):
1✔
13

14
    layer = ApplicationControlLayer
1✔
15

16
    def setUp(self):
1✔
17
        super().setUp()
1✔
18
        self._testapp = TestApp(self.layer.make_wsgi_app())
1✔
19

20
    def publish(self, path, basic=None, form=None, headers=None):
1✔
21
        assert basic
1✔
22
        self._testapp.authorization = ('Basic', tuple(basic.split(':')))
1✔
23

24
        env = {'wsgi.handleErrors': False}
1✔
25
        if form:
1✔
26
            response = self._testapp.post(path, params=form,
1✔
27
                                          extra_environ=env, headers=headers)
28
        else:
29
            response = self._testapp.get(
1✔
30
                path, extra_environ=env, headers=headers)
31
        return response
1✔
32

33

34
class ErrorRedirect(BrowserView):
1✔
35
    # copied from zope.app.error
36
    def action(self):
1✔
37
        # Some locations (eg ++etc++process) throw a TypeError exception when
38
        # finding their absoluteurl, if this happens catch the error and
39
        # redirect the browser to the site root "/@@errorRedirect.html"
40
        # to handle redirection to the site error logger instead
41
        try:
1✔
42
            err = getUtility(IErrorReportingUtility)
1✔
43
            url = absoluteURL(err, self.request)
1✔
44
        except TypeError:
1✔
45
            url = self.request.getApplicationURL() + "/@@errorRedirect.html"
1✔
46
        else:
47
            # The real zope.app.error would redirect to
48
            # url + @@SelectedManagementView.html
49
            raise NotImplementedError()
50

51
        self.request.response.redirect(url)
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc