Changeset 1042 in products
- Timestamp:
- Apr 22, 2009 2:05:54 PM (17 years ago)
- Location:
- quintagroup.portlet.cumulus/trunk/quintagroup/portlet/cumulus
- Files:
-
- 3 edited
-
cumulusportlet.pt (modified) (2 diffs)
-
tests/base.py (modified) (3 diffs)
-
tests/test_portlet.py (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.portlet.cumulus/trunk/quintagroup/portlet/cumulus/cumulusportlet.pt
r1038 r1042 17 17 </p> 18 18 <p style="padding: 1em; margin-bottom: 0;"> 19 WP Cumulus Flash tag cloud by <a href="http://www.roytanck.com">Roy Tanck</a> 19 WP Cumulus Flash tag cloud by <a href="http://www.roytanck.com">Roy Tanck</a> 20 20 requires Flash Player 9 or better. 21 21 </p> … … 41 41 <p style="padding: 1em;" tal:content="structure view/getTagAnchors"></p> 42 42 <p style="padding: 1em; margin-bottom: 0;"> 43 WP-Cumulus by <a href="http://www.roytanck.com/">Roy Tanck</a> 43 WP-Cumulus by <a href="http://www.roytanck.com/">Roy Tanck</a> 44 44 requires Flash Player 9 or better. 45 45 </p> -
quintagroup.portlet.cumulus/trunk/quintagroup/portlet/cumulus/tests/base.py
r1003 r1042 6 6 from Products.PloneTestCase import PloneTestCase as ptc 7 7 from Products.PloneTestCase.layer import onsetup 8 9 try: 10 import Products.QuillsEnabled 11 HAS_QUILLS_ENABLED = True 12 except ImportError: 13 HAS_QUILLS_ENABLED = False 8 14 9 15 @onsetup … … 27 33 28 34 ztc.installPackage('quintagroup.portlet.cumulus') 35 if HAS_QUILLS_ENABLED: 36 ztc.installProduct('QuillsEnabled') 29 37 30 38 # The order here is important: We first call the deferred function and then … … 32 40 33 41 setup_product() 34 ptc.setupPloneSite(products=['quintagroup.portlet.cumulus']) 42 prods = ['quintagroup.portlet.cumulus'] 43 if HAS_QUILLS_ENABLED: 44 prods.append('QuillsEnabled') 45 ptc.setupPloneSite(products=prods) 35 46 36 47 class TestCase(ptc.PloneTestCase): -
quintagroup.portlet.cumulus/trunk/quintagroup/portlet/cumulus/tests/test_portlet.py
r1003 r1042 1 from zope.interface import alsoProvides 1 2 from zope.component import getUtility, getMultiAdapter 2 3 … … 11 12 from quintagroup.portlet.cumulus import cumulusportlet 12 13 13 from quintagroup.portlet.cumulus.tests.base import TestCase 14 14 from quintagroup.portlet.cumulus.tests.base import TestCase, HAS_QUILLS_ENABLED 15 15 16 16 class TestPortlet(TestCase): … … 27 27 28 28 def test_interfaces(self): 29 # TODO: Pass any keyword arguments to the Assignment constructor30 29 portlet = cumulusportlet.Assignment() 31 30 self.failUnless(IPortletAssignment.providedBy(portlet)) … … 41 40 del mapping[m] 42 41 addview = mapping.restrictedTraverse('+/' + portlet.addview) 43 44 # TODO: Pass a dictionary containing dummy form inputs from the add45 # form.46 # Note: if the portlet has a NullAddForm, simply call47 # addview() instead of the next line.48 42 addview.createAndAdd(data={}) 49 43 … … 53 47 54 48 def test_invoke_edit_view(self): 55 # NOTE: This test can be removed if the portlet has no edit form56 49 mapping = PortletAssignmentMapping() 57 50 request = self.folder.REQUEST … … 68 61 context=self.portal) 69 62 70 # TODO: Pass any keyword arguments to the Assignment constructor71 63 assignment = cumulusportlet.Assignment() 72 64 … … 80 72 def afterSetUp(self): 81 73 self.setRoles(('Manager', )) 74 self.portal['front-page'].edit(subject=['global', 'tags']) 75 id_ = self.folder.invokeFactory('Document', id='blog-entry') 76 self.folder[id_].edit(subject=['blog', 'tags']) 77 if HAS_QUILLS_ENABLED: 78 from quills.core.interfaces import IWeblogEnhanced 79 alsoProvides(self.folder, IWeblogEnhanced) 80 self.folder.reindexObject() 82 81 83 82 def renderer(self, context=None, request=None, view=None, manager=None, … … 89 88 IPortletManager, name='plone.rightcolumn', context=self.portal) 90 89 91 # TODO: Pass any default keyword arguments to the Assignment92 # constructor.93 90 assignment = assignment or cumulusportlet.Assignment() 94 91 return getMultiAdapter((context, request, view, manager, assignment), 95 92 IPortletRenderer) 96 93 97 def test_render(self): 98 # TODO: Pass any keyword arguments to the Assignment constructor. 94 def test_render_default(self): 99 95 r = self.renderer(context=self.portal, 100 96 assignment=cumulusportlet.Assignment()) … … 102 98 r.update() 103 99 output = r.render() 104 # TODO: Test output 100 expected = """<script type="text/javascript" 101 src="http://nohost/plone/++resource++swfobject.js"> 102 </script> 103 <div id="comulus"> 104 <p style="display:none;"><a href="http://nohost/plone/search?Subject:list=blog" title="1 entries" rel="tag" style="font-size: 8.0pt;">blog</a> 105 <a href="http://nohost/plone/search?Subject:list=global" title="1 entries" rel="tag" style="font-size: 8.0pt;">global</a> 106 <a href="http://nohost/plone/search?Subject:list=tags" title="2 entries" rel="tag" style="font-size: 22.0pt;">tags</a> 107 </p> 108 <p style="padding: 1em; margin-bottom: 0;"> 109 WP Cumulus Flash tag cloud by <a href="http://www.roytanck.com">Roy Tanck</a> 110 requires Flash Player 9 or better. 111 </p> 112 </div> 113 <script type="text/javascript"> 114 var so = new SWFObject("http://nohost/plone/++resource++tagcloud.swf", "tagcloudflash", "152", "152", "9", "#ffffff"); 115 116 so.addParam("allowScriptAccess", "always"); 117 so.addVariable("tcolor", "0x5391d0"); 118 so.addVariable("tcolor2", "0x333333"); 119 so.addVariable("hicolor", "0x578308"); 120 so.addVariable("tspeed", "100"); 121 so.addVariable("distr", "true"); 122 so.addVariable("mode", "tags"); 123 so.addVariable("tagcloud", "%3Ctags%3E%3Ca%20href%3D%22http%3A//nohost/plone/search%3FSubject%3Alist%3Dblog%22%20title%3D%221%20entries%22%20rel%3D%22tag%22%20style%3D%22font-size%3A%208.0pt%3B%22%3Eblog%3C/a%3E%0A%3Ca%20href%3D%22http%3A//nohost/plone/search%3FSubject%3Alist%3Dglobal%22%20title%3D%221%20entries%22%20rel%3D%22tag%22%20style%3D%22font-size%3A%208.0pt%3B%22%3Eglobal%3C/a%3E%0A%3Ca%20href%3D%22http%3A//nohost/plone/search%3FSubject%3Alist%3Dtags%22%20title%3D%222%20entries%22%20rel%3D%22tag%22%20style%3D%22font-size%3A%2022.0pt%3B%22%3Etags%3C/a%3E%0A%3C/tags%3E"); 124 so.write("comulus"); 125 </script>""" 126 self.failUnless(expected in output, 'Bad output') 105 127 128 def test_render_compmode(self): 129 r = self.renderer(context=self.portal, 130 assignment=cumulusportlet.Assignment(compmode=True, width=200, height=200)) 131 r = r.__of__(self.folder) 132 r.update() 133 output = r.render() 134 expected = """<object type="application/x-shockwave-flash" 135 data="http://nohost/plone/++resource++tagcloud.swf" 136 width="200" height="200"> 137 <param name="movie" 138 value="http://nohost/plone/++resource++tagcloud.swf" /> 139 <param name="bgcolor" value="ffffff" /> 140 <param name="AllowScriptAccess" value="always"> 141 142 <param name="flashvars" 143 value="tcolor=5391d0&tcolor2=333333&hicolor=578308&tspeed=100&distr=true&mode=tags&tagcloud=%3Ctags%3E%3Ca%20href%3D%22http%3A//nohost/plone/search%3FSubject%3Alist%3Dblog%22%20title%3D%221%20entries%22%20rel%3D%22tag%22%20style%3D%22font-size%3A%208.0pt%3B%22%3Eblog%3C/a%3E%0A%3Ca%20href%3D%22http%3A//nohost/plone/search%3FSubject%3Alist%3Dglobal%22%20title%3D%221%20entries%22%20rel%3D%22tag%22%20style%3D%22font-size%3A%208.0pt%3B%22%3Eglobal%3C/a%3E%0A%3Ca%20href%3D%22http%3A//nohost/plone/search%3FSubject%3Alist%3Dtags%22%20title%3D%222%20entries%22%20rel%3D%22tag%22%20style%3D%22font-size%3A%2022.0pt%3B%22%3Etags%3C/a%3E%0A%3C/tags%3E" /> 144 <p style="padding: 1em;"><a href="http://nohost/plone/search?Subject:list=blog" title="1 entries" rel="tag" style="font-size: 8.0pt;">blog</a> 145 <a href="http://nohost/plone/search?Subject:list=global" title="1 entries" rel="tag" style="font-size: 8.0pt;">global</a> 146 <a href="http://nohost/plone/search?Subject:list=tags" title="2 entries" rel="tag" style="font-size: 22.0pt;">tags</a> 147 </p> 148 <p style="padding: 1em; margin-bottom: 0;"> 149 WP-Cumulus by <a href="http://www.roytanck.com/">Roy Tanck</a> 150 requires Flash Player 9 or better. 151 </p> 152 </object>""" 153 self.failUnless(expected in output, 'Bad output') 154 155 if HAS_QUILLS_ENABLED: 156 def test_render_on_blog(self): 157 r = self.renderer(context=self.folder, 158 assignment=cumulusportlet.Assignment(compmode=True, width=200, height=200)) 159 r = r.__of__(self.folder) 160 r.update() 161 output = r.render() 162 expected = """<param name="flashvars" 163 value="tcolor=5391d0&tcolor2=333333&hicolor=578308&tspeed=100&distr=true&mode=tags&tagcloud=%3Ctags%3E%3Ca%20href%3D%22http%3A//nohost/plone/Members/test_user_1_/topics/blog%22%20title%3D%220%20entries%22%20rel%3D%22tag%22%20style%3D%22font-size%3A%208.0pt%3B%22%3Eblog%3C/a%3E%0A%3Ca%20href%3D%22http%3A//nohost/plone/Members/test_user_1_/topics/tags%22%20title%3D%220%20entries%22%20rel%3D%22tag%22%20style%3D%22font-size%3A%208.0pt%3B%22%3Etags%3C/a%3E%0A%3C/tags%3E" />""" 164 self.failUnless(expected in output, 'Bad output') 106 165 107 166 def test_suite():
Note: See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/trac/chrome/common/qtrac_logo.png)