Skip to content

Commit

Permalink
Fix refactoring according cookieplone
Browse files Browse the repository at this point in the history
  • Loading branch information
ksuess committed Oct 6, 2024
1 parent 2d8be2e commit cbd702e
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 32 deletions.
9 changes: 8 additions & 1 deletion src/training/votable/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
"""Init and utils."""

from zope.i18nmessageid import MessageFactory

import logging


PACKAGE_NAME = "training.votable"

_ = MessageFactory(PACKAGE_NAME)

_ = MessageFactory("training.votable")
logger = logging.getLogger(PACKAGE_NAME)

ViewVotesPermission = "training.votable: View Votes"
CanVotePermission = "training.votable: Can Vote"
Expand Down
2 changes: 1 addition & 1 deletion src/training/votable/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
from zope.publisher.interfaces.browser import IDefaultBrowserLayer


class ITrainingVotableLayer(IDefaultBrowserLayer):
class IBrowserLayer(IDefaultBrowserLayer):
"""Marker interface that defines a browser layer."""
2 changes: 1 addition & 1 deletion src/training/votable/profiles/default/browserlayer.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<layers>
<layer interface="training.votable.interfaces.ITrainingVotableLayer"
<layer interface="training.votable.interfaces.IBrowserLayer"
name="training.votable"
/>
</layers>
39 changes: 14 additions & 25 deletions src/training/votable/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,21 @@
from plone.app.testing import FunctionalTesting
from plone.app.testing import IntegrationTesting
from plone.app.testing import PloneSandboxLayer
from plone.testing import z2
from plone.testing import zope
from plone.testing.zope import WSGI_SERVER_FIXTURE

import training.votable # noQA

# from zope.configuration import xmlconfig


class TrainingVotableLayer(PloneSandboxLayer):
class Layer(PloneSandboxLayer):
defaultBases = (PLONE_APP_CONTENTTYPES_FIXTURE,)

def setUpZope(self, app, configurationContext):
# Load any other ZCML that is required for your tests.
# The z3c.autoinclude feature is disabled in the Plone fixture base
# layer.
import plone.app.dexterity

self.loadZCML(package=plone.app.dexterity)

import plone.restapi

self.loadZCML(package=plone.restapi)

# training.votable
import training.votable

self.loadZCML(package=training.votable)
self.loadZCML("testing.zcml", package=training.votable)

Expand All @@ -37,26 +27,25 @@ def setUpPloneSite(self, portal):
applyProfile(portal, "training.votable:testing")


TRAINING_VOTABLE_FIXTURE = TrainingVotableLayer()

FIXTURE = Layer()

TRAINING_VOTABLE_INTEGRATION_TESTING = IntegrationTesting(
bases=(TRAINING_VOTABLE_FIXTURE,),
name="TrainingVotableLayer:IntegrationTesting",
INTEGRATION_TESTING = IntegrationTesting(
bases=(FIXTURE,),
name="Training.VotableLayer:IntegrationTesting",
)


TRAINING_VOTABLE_FUNCTIONAL_TESTING = FunctionalTesting(
bases=(TRAINING_VOTABLE_FIXTURE, zope.WSGI_SERVER_FIXTURE),
name="TrainingVotableLayer:FunctionalTesting",
FUNCTIONAL_TESTING = FunctionalTesting(
bases=(FIXTURE, WSGI_SERVER_FIXTURE),
name="Training.VotableLayer:FunctionalTesting",
)


TRAINING_VOTABLE_ACCEPTANCE_TESTING = FunctionalTesting(
ACCEPTANCE_TESTING = FunctionalTesting(
bases=(
TRAINING_VOTABLE_FIXTURE,
FIXTURE,
REMOTE_LIBRARY_BUNDLE_FIXTURE,
z2.ZSERVER_FIXTURE,
WSGI_SERVER_FIXTURE,
),
name="TrainingVotableLayer:AcceptanceTesting",
name="Training.VotableLayer:AcceptanceTesting",
)
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Content-Type: application/json
"items": []
},
"contributors": [],
"created": "1995-07-31T13:45:00",
"created": "1995-07-31T13:45:00+00:00",
"creators": [
"test_user_1_"
],
Expand All @@ -53,7 +53,7 @@ Content-Type: application/json
"locked": false,
"stealable": true
},
"modified": "1995-07-31T17:30:00",
"modified": "1995-07-31T17:30:00+00:00",
"next_item": {},
"parent": {
"@id": "http://localhost:55001/plone",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from plone.restapi.testing import RelativeSession
from plone.restapi.tests.statictime import StaticTime
from plone.testing.zope import Browser
from training.votable.testing import TRAINING_VOTABLE_FUNCTIONAL_TESTING
from training.votable.testing import FUNCTIONAL_TESTING
from zope.component.hooks import getSite

import collections
Expand Down Expand Up @@ -182,7 +182,7 @@ def tearDown(self):


class TestVoting(TestVotingBase):
layer = TRAINING_VOTABLE_FUNCTIONAL_TESTING
layer = FUNCTIONAL_TESTING

def setUp(self):
self.app = self.layer["app"]
Expand Down

0 comments on commit cbd702e

Please sign in to comment.