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

zopefoundation / Zope / 6263629025

21 Sep 2023 03:12PM UTC coverage: 82.146% (-0.01%) from 82.159%
6263629025

Pull #1164

github

web-flow
[pre-commit.ci lite] apply automatic fixes
Pull Request #1164: Move all linters to pre-commit.

4353 of 6963 branches covered (0.0%)

Branch coverage included in aggregate %.

487 of 487 new or added lines in 186 files covered. (100.0%)

27394 of 31684 relevant lines covered (86.46%)

0.86 hits per line

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

96.0
/src/Products/Five/tests/testing/simplecontent.py
1
##############################################################################
2
#
3
# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
4
# All Rights Reserved.
5
#
6
# This software is subject to the provisions of the Zope Public License,
7
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
8
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11
# FOR A PARTICULAR PURPOSE.
12
#
13
##############################################################################
14
"""Simple content class(es) for browser tests."""
1✔
15

16
from AccessControl.class_init import InitializeClass
1✔
17
from AccessControl.SecurityInfo import ClassSecurityInfo
1✔
18
from OFS.SimpleItem import SimpleItem
1✔
19
from zope.interface import Interface
1✔
20
from zope.interface import implementer
1✔
21

22

23
class ISimpleContent(Interface):
1✔
24
    pass
1✔
25

26

27
class ICallableSimpleContent(ISimpleContent):
1✔
28
    pass
1✔
29

30

31
class IIndexSimpleContent(ISimpleContent):
1✔
32
    pass
1✔
33

34

35
@implementer(ISimpleContent)
1✔
36
class SimpleContent(SimpleItem):
1✔
37

38
    meta_type = 'Five SimpleContent'
1✔
39
    security = ClassSecurityInfo()
1✔
40

41
    def __init__(self, id, title):
1✔
42
        self.id = id
1✔
43
        self.title = title
1✔
44

45
    @security.public
1✔
46
    def mymethod(self):
1✔
47
        return "Hello world"
1✔
48

49
    @security.public
1✔
50
    def direct(self):
1✔
51
        """Should be able to traverse directly to this as there is no view."""
52
        return "Direct traversal worked"
×
53

54

55
InitializeClass(SimpleContent)
1✔
56

57

58
@implementer(ICallableSimpleContent)
1✔
59
class CallableSimpleContent(SimpleItem):
1✔
60
    """A Viewable piece of content."""
61

62
    meta_type = "Five CallableSimpleContent"
1✔
63

64
    def __call__(self, *args, **kw):
1✔
65
        """."""  # We need some content to be traversable.
66
        return "Default __call__ called"
×
67

68

69
InitializeClass(CallableSimpleContent)
1✔
70

71

72
@implementer(IIndexSimpleContent)
1✔
73
class IndexSimpleContent(SimpleItem):
1✔
74
    """A Viewable piece of content."""
75

76
    meta_type = 'Five IndexSimpleContent'
1✔
77

78
    def index_html(self, *args, **kw):
1✔
79
        """."""  # We need some content to be traversable.
80
        return "Default index_html called"
1✔
81

82

83
InitializeClass(IndexSimpleContent)
1✔
84

85

86
def manage_addSimpleContent(self, id, title, REQUEST=None):
1✔
87
    """Add the simple content."""
88
    self._setObject(id, SimpleContent(id, title))
1✔
89

90

91
def manage_addCallableSimpleContent(self, id, title, REQUEST=None):
1✔
92
    """Add the viewable simple content."""
93
    self._setObject(id, CallableSimpleContent(id, title))
1✔
94

95

96
def manage_addIndexSimpleContent(self, id, title, REQUEST=None):
1✔
97
    """Add the viewable simple content."""
98
    self._setObject(id, IndexSimpleContent(id, title))
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