Fix whitespace/Pep8/Pyflakes in tests.
This commit is contained in:
parent
1f01a71aac
commit
e17cfa68a1
@ -16,4 +16,3 @@ plugin:
|
|||||||
- name: "coverage"
|
- name: "coverage"
|
||||||
jar: "../../../../parts/jstestdriver/coverage.jar"
|
jar: "../../../../parts/jstestdriver/coverage.jar"
|
||||||
module: "com.google.jstestdriver.coverage.CoverageModule"
|
module: "com.google.jstestdriver.coverage.CoverageModule"
|
||||||
|
|
@ -13,7 +13,8 @@ from Products.CMFCore.utils import getToolByName
|
|||||||
|
|
||||||
from plone.app.testing import TEST_USER_ID, setRoles
|
from plone.app.testing import TEST_USER_ID, setRoles
|
||||||
|
|
||||||
from plone.app.discussion.testing import PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
from plone.app.discussion.testing import \
|
||||||
|
PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
||||||
|
|
||||||
from plone.app.discussion.interfaces import IConversation
|
from plone.app.discussion.interfaces import IConversation
|
||||||
|
|
||||||
@ -320,7 +321,9 @@ class CommentCatalogTest(unittest.TestCase):
|
|||||||
|
|
||||||
brains = self.catalog.searchResults(dict(
|
brains = self.catalog.searchResults(dict(
|
||||||
portal_type="Discussion Item",
|
portal_type="Discussion Item",
|
||||||
path={'query': '/'.join(self.portal.folder2.getPhysicalPath())}
|
path={
|
||||||
|
'query': '/'.join(self.portal.folder2.getPhysicalPath())
|
||||||
|
}
|
||||||
))
|
))
|
||||||
self.assertEquals(len(brains), 1)
|
self.assertEquals(len(brains), 1)
|
||||||
self.assertEquals(brains[0].getPath(),
|
self.assertEquals(brains[0].getPath(),
|
||||||
@ -333,7 +336,8 @@ class CommentCatalogTest(unittest.TestCase):
|
|||||||
|
|
||||||
self.portal.manage_renameObject("doc1", "doc2")
|
self.portal.manage_renameObject("doc1", "doc2")
|
||||||
|
|
||||||
brains = self.catalog.searchResults(portal_type = 'Discussion Item')
|
brains = self.catalog.searchResults(
|
||||||
|
portal_type='Discussion Item')
|
||||||
self.assertEquals(len(brains), 1)
|
self.assertEquals(len(brains), 1)
|
||||||
self.assertEquals(brains[0].getPath(),
|
self.assertEquals(brains[0].getPath(),
|
||||||
'/plone/doc2/++conversation++default/' +
|
'/plone/doc2/++conversation++default/' +
|
||||||
|
@ -13,7 +13,8 @@ from Products.CMFCore.utils import getToolByName
|
|||||||
|
|
||||||
from plone.app.testing import TEST_USER_ID, setRoles
|
from plone.app.testing import TEST_USER_ID, setRoles
|
||||||
|
|
||||||
from plone.app.discussion.testing import PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
from plone.app.discussion.testing import \
|
||||||
|
PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
||||||
|
|
||||||
from plone.app.discussion.interfaces import IComment, IConversation, IReplies
|
from plone.app.discussion.interfaces import IComment, IConversation, IReplies
|
||||||
|
|
||||||
@ -23,6 +24,7 @@ from plone.app.discussion.browser.comment import View
|
|||||||
logger = logging.getLogger('plone.app.discussion.tests')
|
logger = logging.getLogger('plone.app.discussion.tests')
|
||||||
logger.addHandler(logging.StreamHandler())
|
logger.addHandler(logging.StreamHandler())
|
||||||
|
|
||||||
|
|
||||||
class CommentTest(unittest.TestCase):
|
class CommentTest(unittest.TestCase):
|
||||||
|
|
||||||
layer = PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
layer = PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
||||||
@ -44,7 +46,8 @@ class CommentTest(unittest.TestCase):
|
|||||||
self.assertTrue(IComment.providedBy(comment1))
|
self.assertTrue(IComment.providedBy(comment1))
|
||||||
|
|
||||||
def test_UTCDates(self):
|
def test_UTCDates(self):
|
||||||
utc_to_local_diff = datetime.datetime.now() - datetime.datetime.utcnow()
|
utc_to_local_diff = \
|
||||||
|
datetime.datetime.now() - datetime.datetime.utcnow()
|
||||||
utc_to_local_diff = abs(utc_to_local_diff.seconds)
|
utc_to_local_diff = abs(utc_to_local_diff.seconds)
|
||||||
if utc_to_local_diff < 60:
|
if utc_to_local_diff < 60:
|
||||||
logger.warning("Your computer is living in a timezone where local "
|
logger.warning("Your computer is living in a timezone where local "
|
||||||
|
@ -35,7 +35,8 @@ from plone.app.discussion.browser.comments import CommentsViewlet
|
|||||||
from plone.app.discussion.browser.comments import CommentForm
|
from plone.app.discussion.browser.comments import CommentForm
|
||||||
from plone.app.discussion import interfaces
|
from plone.app.discussion import interfaces
|
||||||
from plone.app.discussion.interfaces import IConversation
|
from plone.app.discussion.interfaces import IConversation
|
||||||
from plone.app.discussion.testing import PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
from plone.app.discussion.testing import \
|
||||||
|
PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
||||||
from plone.app.discussion.interfaces import IDiscussionSettings
|
from plone.app.discussion.interfaces import IDiscussionSettings
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,14 +8,15 @@ from zope.annotation.interfaces import IAnnotations
|
|||||||
from Products.CMFCore.utils import getToolByName
|
from Products.CMFCore.utils import getToolByName
|
||||||
|
|
||||||
from plone.app.testing import TEST_USER_ID, setRoles
|
from plone.app.testing import TEST_USER_ID, setRoles
|
||||||
from plone.app.testing import logout, login
|
|
||||||
|
|
||||||
from plone.app.discussion.testing import PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
from plone.app.discussion.testing import \
|
||||||
|
PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
||||||
|
|
||||||
from plone.app.discussion.browser.migration import View
|
from plone.app.discussion.browser.migration import View
|
||||||
|
|
||||||
from plone.app.discussion.interfaces import IConversation, IComment
|
from plone.app.discussion.interfaces import IConversation, IComment
|
||||||
|
|
||||||
|
|
||||||
class MigrationTest(unittest.TestCase):
|
class MigrationTest(unittest.TestCase):
|
||||||
|
|
||||||
layer = PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
layer = PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
||||||
@ -37,7 +38,6 @@ class MigrationTest(unittest.TestCase):
|
|||||||
self.workflowTool.doActionFor(self.portal.doc, 'publish')
|
self.workflowTool.doActionFor(self.portal.doc, 'publish')
|
||||||
|
|
||||||
self.request.set("test", True)
|
self.request.set("test", True)
|
||||||
context = getattr(self.portal, 'doc')
|
|
||||||
self.view = View(self.portal, self.request)
|
self.view = View(self.portal, self.request)
|
||||||
self.workflowTool.setChainForPortalTypes(('Discussion Item',),
|
self.workflowTool.setChainForPortalTypes(('Discussion Item',),
|
||||||
'comment_review_workflow')
|
'comment_review_workflow')
|
||||||
@ -80,9 +80,9 @@ class MigrationTest(unittest.TestCase):
|
|||||||
datetime(2003, 3, 11, 9, 28, 6))
|
datetime(2003, 3, 11, 9, 28, 6))
|
||||||
self.assertEqual(comment1.modification_date,
|
self.assertEqual(comment1.modification_date,
|
||||||
datetime(2009, 7, 12, 19, 38, 7))
|
datetime(2009, 7, 12, 19, 38, 7))
|
||||||
self.assertEqual(
|
self.assertEqual([
|
||||||
[{'comment': comment1, 'depth': 0, 'id': long(comment1.id)},]
|
{'comment': comment1, 'depth': 0, 'id': long(comment1.id)}
|
||||||
, list(conversation.getThreads()))
|
], list(conversation.getThreads()))
|
||||||
self.assertFalse(self.doc.talkback)
|
self.assertFalse(self.doc.talkback)
|
||||||
|
|
||||||
def test_migrate_nested_comments(self):
|
def test_migrate_nested_comments(self):
|
||||||
|
@ -63,7 +63,9 @@ class ModerationViewTest(unittest.TestCase):
|
|||||||
discussion = getToolByName(self.portal, 'portal_discussion', None)
|
discussion = getToolByName(self.portal, 'portal_discussion', None)
|
||||||
discussion.overrideDiscussionFor(self.portal.doc1, 1)
|
discussion.overrideDiscussionFor(self.portal.doc1, 1)
|
||||||
talkback = discussion.getDiscussionFor(self.portal.doc1)
|
talkback = discussion.getDiscussionFor(self.portal.doc1)
|
||||||
self.portal.doc1.talkback.createReply('My Title', 'My Text', Creator='Jim')
|
self.portal.doc1.talkback.createReply('My Title',
|
||||||
|
'My Text',
|
||||||
|
Creator='Jim')
|
||||||
reply = talkback.getReplies()[0]
|
reply = talkback.getReplies()[0]
|
||||||
reply.setReplyTo(self.portal.doc1)
|
reply.setReplyTo(self.portal.doc1)
|
||||||
reply.creation_date = DateTime(2003, 3, 11, 9, 28, 6)
|
reply.creation_date = DateTime(2003, 3, 11, 9, 28, 6)
|
||||||
@ -79,6 +81,7 @@ class ModerationViewTest(unittest.TestCase):
|
|||||||
self.assertTrue('No comments to moderate' in view)
|
self.assertTrue('No comments to moderate' in view)
|
||||||
self.assertEqual(len(self.view.comments), 0)
|
self.assertEqual(len(self.view.comments), 0)
|
||||||
|
|
||||||
|
|
||||||
class ModerationBulkActionsViewTest(unittest.TestCase):
|
class ModerationBulkActionsViewTest(unittest.TestCase):
|
||||||
|
|
||||||
layer = PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
layer = PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
||||||
@ -183,5 +186,6 @@ class ModerationBulkActionsViewTest(unittest.TestCase):
|
|||||||
self.assertTrue(comment)
|
self.assertTrue(comment)
|
||||||
self.assertEqual(comment, self.comment2)
|
self.assertEqual(comment, self.comment2)
|
||||||
|
|
||||||
|
|
||||||
def test_suite():
|
def test_suite():
|
||||||
return unittest.defaultTestLoader.loadTestsFromName(__name__)
|
return unittest.defaultTestLoader.loadTestsFromName(__name__)
|
||||||
|
@ -272,5 +272,6 @@ class TestModeratorNotificationUnit(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertEqual(len(self.mailhost.messages), 0)
|
self.assertEqual(len(self.mailhost.messages), 0)
|
||||||
|
|
||||||
|
|
||||||
def test_suite():
|
def test_suite():
|
||||||
return unittest.defaultTestLoader.loadTestsFromName(__name__)
|
return unittest.defaultTestLoader.loadTestsFromName(__name__)
|
||||||
|
@ -15,7 +15,8 @@ from Products.CMFCore.permissions import View
|
|||||||
from plone.app.testing import TEST_USER_ID, setRoles
|
from plone.app.testing import TEST_USER_ID, setRoles
|
||||||
from plone.app.testing import logout, login
|
from plone.app.testing import logout, login
|
||||||
|
|
||||||
from plone.app.discussion.testing import PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
from plone.app.discussion.testing import \
|
||||||
|
PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
||||||
from plone.app.discussion.interfaces import IConversation, IDiscussionLayer
|
from plone.app.discussion.interfaces import IConversation, IDiscussionLayer
|
||||||
|
|
||||||
|
|
||||||
@ -163,7 +164,6 @@ class CommentReviewWorkflowTest(unittest.TestCase):
|
|||||||
|
|
||||||
layer = PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
layer = PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
||||||
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.portal = self.layer['portal']
|
self.portal = self.layer['portal']
|
||||||
setRoles(self.portal, TEST_USER_ID, ['Manager'])
|
setRoles(self.portal, TEST_USER_ID, ['Manager'])
|
||||||
|
Loading…
Reference in New Issue
Block a user