Skip to content

Commit

Permalink
More refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
hvelarde committed Jan 15, 2016
1 parent 3082994 commit 5686e17
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
'plone.cachepurging',
'plone.testing',
'Products.PloneFormGen <1.8.0.alpha1',
'tzlocal',
],
},
entry_points="""
Expand Down
30 changes: 25 additions & 5 deletions src/collective/cover/tests/test_list_tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@
from collective.cover.tiles.list import IListTile
from collective.cover.tiles.list import ListTile
from DateTime import DateTime
from datetime import datetime
from datetime import timedelta
from mock import Mock
from plone import api
from plone.app.testing import login
from plone.app.testing import logout
from plone.app.testing import TEST_USER_NAME
from plone.tiles.interfaces import ITileDataManager
from plone.uuid.interfaces import IUUID
from tzlocal import get_localzone

import unittest

TZNAME = get_localzone().zone


class ListTileTestCase(TestTileMixin, unittest.TestCase):

Expand Down Expand Up @@ -172,12 +177,19 @@ def test_results(self):
self.assertIn(folder[str(i)], results)

def test_show_start_date_on_events(self):
from DateTime import DateTime
tomorrow = DateTime() + 1
tomorrow = datetime.today() + timedelta(days=1)
# create an Event starting tomorrow
with api.env.adopt_roles(['Manager']):
event = api.content.create(
self.portal, 'Event', 'event', startDate=tomorrow)
self.portal,
'Event',
'event',
startDate=DateTime(tomorrow), # Archetypes
endDate=DateTime(tomorrow),
start=tomorrow, # Dexterity
end=tomorrow,
timezone=TZNAME,
)
api.content.transition(event, 'publish')

self.tile.populate_with_object(event)
Expand All @@ -186,11 +198,19 @@ def test_show_start_date_on_events(self):
self.assertIn(tomorrow, rendered)

def test_localized_time_is_rendered(self):
tomorrow = DateTime() + 1
tomorrow = datetime.today() + timedelta(days=1)
# create an Event starting tomorrow
with api.env.adopt_roles(['Manager']):
event = api.content.create(
self.portal, 'Event', 'event', startDate=tomorrow)
self.portal,
'Event',
'event',
startDate=DateTime(tomorrow), # Archetypes
endDate=DateTime(tomorrow),
start=tomorrow, # Dexterity
end=tomorrow,
timezone=TZNAME,
)
api.content.transition(event, 'publish')

self.tile.populate_with_object(event)
Expand Down
4 changes: 0 additions & 4 deletions src/collective/cover/tests/test_richtext_tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ def test_default_configuration(self):
def test_accepted_content_types(self):
self.assertEqual(self.tile.accepted_ct(), ['Document'])

def test_populate_with_object(self):
self.tile.populate_with_object(self.portal['my-document'])
self.assertEqual(self.tile.getText(), '')

def test_render_empty(self):
msg = 'Please edit the tile to enter some text.'

Expand Down

0 comments on commit 5686e17

Please sign in to comment.