Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fail methods are deprecated; minor style changes

  • Loading branch information...
commit 16d3d09ee8e979334be0f14a9146ed648b28569e 1 parent f48015c
@hvelarde hvelarde authored
View
62 src/collective/twitter/portlets/tests/test_profile_portlet.py
@@ -30,28 +30,24 @@ def setUp(self):
setRoles(self.portal, TEST_USER_ID, ['Manager'])
def test_portlet_type_registered(self):
- portlet = getUtility(
- IPortletType,
- name='collective.twitter.portlets.TwitterProfilePortlet')
- self.assertEquals(portlet.addview,
- 'collective.twitter.portlets.TwitterProfilePortlet')
+ name = 'collective.twitter.portlets.TwitterProfilePortlet'
+ portlet = getUtility(IPortletType, name=name)
+ self.assertEqual(portlet.addview, name)
def test_interfaces(self):
# TODO: Pass any keyword arguments to the Assignment constructor
portlet = twprofile.Assignment(tw_account=u"test",
- tw_user=u"Test",
- show_avatars=False,
- max_results=20)
+ tw_user=u"Test",
+ show_avatars=False,
+ max_results=20)
- self.failUnless(IPortletAssignment.providedBy(portlet))
- self.failUnless(IPortletDataProvider.providedBy(portlet.data))
+ self.assertTrue(IPortletAssignment.providedBy(portlet))
+ self.assertTrue(IPortletDataProvider.providedBy(portlet.data))
def test_invoke_add_view(self):
- portlet = getUtility(
- IPortletType,
- name='collective.twitter.portlets.TwitterProfilePortlet')
- mapping = self.portal.restrictedTraverse(
- '++contextportlets++plone.leftcolumn')
+ name = 'collective.twitter.portlets.TwitterProfilePortlet'
+ portlet = getUtility(IPortletType, name=name)
+ mapping = self.portal.restrictedTraverse('++contextportlets++plone.leftcolumn')
for m in mapping.keys():
del mapping[m]
addview = mapping.restrictedTraverse('+/' + portlet.addview)
@@ -65,9 +61,8 @@ def test_invoke_add_view(self):
'show_avatars': False,
'max_results': 20})
- self.assertEquals(len(mapping), 1)
- self.failUnless(isinstance(mapping.values()[0],
- twprofile.Assignment))
+ self.assertEqual(len(mapping), 1)
+ self.assertTrue(isinstance(mapping.values()[0], twprofile.Assignment))
def test_invoke_edit_view(self):
# NOTE: This test can be removed if the portlet has no edit form
@@ -75,12 +70,12 @@ def test_invoke_edit_view(self):
request = self.request
mapping['foo'] = twprofile.Assignment(tw_account=u"test",
- tw_user=u"Test",
- show_avatars=False,
- max_results=20)
+ tw_user=u"Test",
+ show_avatars=False,
+ max_results=20)
editview = getMultiAdapter((mapping['foo'], request), name='edit')
- self.failUnless(isinstance(editview, twprofile.EditForm))
+ self.assertTrue(isinstance(editview, twprofile.EditForm))
def test_obtain_renderer(self):
context = self.portal
@@ -91,13 +86,13 @@ def test_obtain_renderer(self):
# TODO: Pass any keyword arguments to the Assignment constructor
assignment = twprofile.Assignment(tw_account=u"test",
- tw_user=u"Test",
- show_avatars=False,
- max_results=20)
+ tw_user=u"Test",
+ show_avatars=False,
+ max_results=20)
- renderer = getMultiAdapter(
- (context, request, view, manager, assignment), IPortletRenderer)
- self.failUnless(isinstance(renderer, twprofile.Renderer))
+ renderer = getMultiAdapter((context, request, view, manager, assignment),
+ IPortletRenderer)
+ self.assertTrue(isinstance(renderer, twprofile.Renderer))
class RenderTest(unittest.TestCase):
@@ -114,8 +109,9 @@ def renderer(self, context=None, request=None, view=None, manager=None,
context = context or self.portal
request = request or self.request
view = view or self.portal.restrictedTraverse('@@plone')
- manager = manager or getUtility(
- IPortletManager, name='plone.rightcolumn', context=self.portal)
+ manager = manager or getUtility(IPortletManager,
+ name='plone.rightcolumn',
+ context=self.portal)
# TODO: Pass any default keyword arguments to the Assignment
# constructor.
@@ -127,9 +123,9 @@ def test_render(self):
# TODO: Pass any keyword arguments to the Assignment constructor.
r = self.renderer(context=self.portal,
assignment=twprofile.Assignment(tw_account=u"test",
- tw_user=u"Test",
- show_avatars=False,
- max_results=20))
+ tw_user=u"Test",
+ show_avatars=False,
+ max_results=20))
r = r.__of__(self.portal)
r.update()
#output = r.render()
View
44 src/collective/twitter/portlets/tests/test_search_portlet.py
@@ -30,11 +30,9 @@ def setUp(self):
setRoles(self.portal, TEST_USER_ID, ['Manager'])
def test_portlet_type_registered(self):
- portlet = getUtility(
- IPortletType,
- name='collective.twitter.portlets.TwitterSearchPortlet')
- self.assertEquals(portlet.addview,
- 'collective.twitter.portlets.TwitterSearchPortlet')
+ name = 'collective.twitter.portlets.TwitterSearchPortlet'
+ portlet = getUtility(IPortletType, name=name)
+ self.assertEqual(portlet.addview, name)
def test_interfaces(self):
# TODO: Pass any keyword arguments to the Assignment constructor
@@ -43,15 +41,13 @@ def test_interfaces(self):
show_avatars=False,
max_results=20)
- self.failUnless(IPortletAssignment.providedBy(portlet))
- self.failUnless(IPortletDataProvider.providedBy(portlet.data))
+ self.assertTrue(IPortletAssignment.providedBy(portlet))
+ self.assertTrue(IPortletDataProvider.providedBy(portlet.data))
def test_invoke_add_view(self):
- portlet = getUtility(
- IPortletType,
- name='collective.twitter.portlets.TwitterSearchPortlet')
- mapping = self.portal.restrictedTraverse(
- '++contextportlets++plone.leftcolumn')
+ name = 'collective.twitter.portlets.TwitterSearchPortlet'
+ portlet = getUtility(IPortletType, name=name)
+ mapping = self.portal.restrictedTraverse('++contextportlets++plone.leftcolumn')
for m in mapping.keys():
del mapping[m]
addview = mapping.restrictedTraverse('+/' + portlet.addview)
@@ -65,9 +61,8 @@ def test_invoke_add_view(self):
'show_avatars': False,
'max_results': 20})
- self.assertEquals(len(mapping), 1)
- self.failUnless(isinstance(mapping.values()[0],
- twsearch.Assignment))
+ self.assertEqual(len(mapping), 1)
+ self.assertTrue(isinstance(mapping.values()[0], twsearch.Assignment))
def test_invoke_edit_view(self):
# NOTE: This test can be removed if the portlet has no edit form
@@ -80,7 +75,7 @@ def test_invoke_edit_view(self):
max_results=20)
editview = getMultiAdapter((mapping['foo'], request), name='edit')
- self.failUnless(isinstance(editview, twsearch.EditForm))
+ self.assertTrue(isinstance(editview, twsearch.EditForm))
def test_obtain_renderer(self):
context = self.portal
@@ -95,9 +90,9 @@ def test_obtain_renderer(self):
show_avatars=False,
max_results=20)
- renderer = getMultiAdapter(
- (context, request, view, manager, assignment), IPortletRenderer)
- self.failUnless(isinstance(renderer, twsearch.Renderer))
+ renderer = getMultiAdapter((context, request, view, manager, assignment),
+ IPortletRenderer)
+ self.assertTrue(isinstance(renderer, twsearch.Renderer))
class RenderTest(unittest.TestCase):
@@ -114,8 +109,9 @@ def renderer(self, context=None, request=None, view=None, manager=None,
context = context or self.portal
request = request or self.request
view = view or self.portal.restrictedTraverse('@@plone')
- manager = manager or getUtility(
- IPortletManager, name='plone.rightcolumn', context=self.portal)
+ manager = manager or getUtility(IPortletManager,
+ name='plone.rightcolumn',
+ context=self.portal)
# TODO: Pass any default keyword arguments to the Assignment
# constructor.
@@ -127,9 +123,9 @@ def test_render(self):
# TODO: Pass any keyword arguments to the Assignment constructor.
r = self.renderer(context=self.portal,
assignment=twsearch.Assignment(tw_account=u"test",
- search_string=u"Test",
- show_avatars=False,
- max_results=20))
+ search_string=u"Test",
+ show_avatars=False,
+ max_results=20))
r = r.__of__(self.portal)
r.update()
#output = r.render()
Please sign in to comment.
Something went wrong with that request. Please try again.