Permalink
Browse files

Code cleanup

  • Loading branch information...
1 parent 4c37d31 commit fa963922811c2dba1ec8d058febfff5466e52d7c @maethu maethu committed Mar 4, 2014
Showing with 19 additions and 18 deletions.
  1. +19 −18 ftw/tooltip/tests/test_tooltip.py
@@ -1,17 +1,17 @@
+from ftw.tooltip.demo_tooltip_source import DemoContentTooltipSource
+from ftw.tooltip.demo_tooltip_source import DemoDynamicTooltipSource
+from ftw.tooltip.demo_tooltip_source import DemoStaticTooltipSource
+from ftw.tooltip.interfaces import ITooltipSource
from ftw.tooltip.testing import FTWTOOLTIP_ZCML_LAYER
from plone.mocktestcase import MockTestCase
+from zope.browser.interfaces import IBrowserView
+from zope.component import adapts
+from zope.component import getGlobalSiteManager
from zope.component import getMultiAdapter, queryMultiAdapter
-from zope.interface.verify import verifyClass
from zope.interface import directlyProvides
-from ftw.tooltip.interfaces import ITooltipSource
-from zope.publisher.interfaces.browser import IDefaultBrowserLayer
-from ftw.tooltip.demo_tooltip_source import (DemoStaticTooltipSource,
- DemoDynamicTooltipSource, DemoContentTooltipSource)
-from zope.component import getGlobalSiteManager
-from zope.browser.interfaces import IBrowserView
from zope.interface import Interface, implements
-from zope.component import adapts
-from mocker import ANY
+from zope.interface.verify import verifyClass
+from zope.publisher.interfaces.browser import IDefaultBrowserLayer
class TestTooltip(MockTestCase):
@@ -64,20 +64,21 @@ def test_condition_key(self):
def test_js_view_registered(self):
view = getMultiAdapter((object(), self.request),
- name="dynamic_tooltips.js")
+ name="dynamic_tooltips.js")
self.assertTrue(view)
def test_get_all_tooltip(self):
view = getMultiAdapter((object(), self.request),
- name="dynamic_tooltips.js")
+ name="dynamic_tooltips.js")
for name, adapter in view.get_all_tips():
- self.assertTrue(adapter.__class__.__name__ in
+ self.assertTrue(
+ adapter.__class__.__name__ in
['DemoDynamicTooltipSource', 'DemoStaticTooltipSource'])
self.assertTrue(isinstance(name, basestring))
def test_tooltip_js_generation(self):
view = getMultiAdapter((object(), self.request),
- name="dynamic_tooltips.js")
+ name="dynamic_tooltips.js")
js = view.generate_tooltip_js_source()
self.assertEqual(
js,
@@ -91,7 +92,7 @@ def test_tooltip_js_multiple_adapters_generation(self):
# the title attr of the matched element
self.gsm.registerAdapter(DemoDynamicTooltipSource, name="demo2")
view = getMultiAdapter((object(), self.request),
- name="dynamic_tooltips.js")
+ name="dynamic_tooltips.js")
js = view.generate_tooltip_js_source()
self.assertEqual(
js,
@@ -106,7 +107,7 @@ def test_tooltip_js_multiple_adapters_generation(self):
def test_tooltip_js_generation_with_content(self):
self.gsm.registerAdapter(DemoContentTooltipSource, name="demo2")
view = getMultiAdapter((object(), self.request),
- name="dynamic_tooltips.js")
+ name="dynamic_tooltips.js")
js = view.generate_tooltip_js_source()
self.assertEqual(
@@ -121,12 +122,12 @@ def test_tooltip_js_generation_with_content(self):
def test_hole_js(self):
view = getMultiAdapter((object(), self.request),
- name="dynamic_tooltips.js")
+ name="dynamic_tooltips.js")
self.assertIn(view.generate_tooltip_js_source(), view())
def test_tooltip_default_layout(self):
view = getMultiAdapter((object(), self.request),
- name="dynamic_tooltips.js")
+ name="dynamic_tooltips.js")
self.assertEqual(view.get_tooltip_layout(), "<div class='tooltip'/>")
def test_tooltip_custom_layout(self):
@@ -145,7 +146,7 @@ def __call__(self):
self.gsm.registerAdapter(ToolTipSpecifigLayout,
name="ftw_tooltip_layout")
view = getMultiAdapter((object(), self.request),
- name="dynamic_tooltips.js")
+ name="dynamic_tooltips.js")
self.assertEqual(view.get_tooltip_layout(),
"<div class=\\'MyToolTipCustomKlass\\'/>")
self.assertIn(

0 comments on commit fa96392

Please sign in to comment.