Changeset 3019 in products for quintagroup.analytics/trunk/quintagroup/analytics/tests.py
- Timestamp:
- Nov 15, 2010 1:07:25 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.analytics/trunk/quintagroup/analytics/tests.py
r3017 r3019 278 278 self.assertEqual(*map(lambda s:''.join(s.split()), 279 279 [chart_tag, self.view.getChart()])) 280 281 class TestTypeByState(TestCase): 282 """Tests all type_by_state view methods.""" 283 layer = SetUpContent 284 states = ['private', 'published', 'pending'] 285 286 def afterSetUp(self): 287 self.view = queryMultiAdapter((self.portal, self.portal.REQUEST), 288 name="type_by_state") 289 self.pc = self.portal.portal_catalog 290 291 def test_getTypes(self): 292 """ Tests method that returns ordered list of types.""" 293 self.assert_(False not in map(lambda t1, t2:t1==t2, 294 ['Folder', 'Document', 'Event', 'Topic'], 295 self.view.getTypes())) 296 297 def test_getStates(self): 298 """ Tests method that returns ordered list of states.""" 299 self.assert_(False not in map(lambda s1, s2:s1==s2, 300 ['private', 'published'], self.view.getStates())) 301 302 def test_getContent(self): 303 """ This test verifies method that returns list of numbers. 304 Each number is amount of specified content type objects 305 that owned by particular user. 306 """ 307 # we need to login in to the site as Manager to be able to 308 # see catalog results 309 self.loginAsPortalOwner() 310 311 for state in self.states: 312 self.assert_(False not in \ 313 map(lambda i, j:i==j, [len(self.pc(portal_type=type_, 314 review_state=state)) 315 for type_ in self.view.getTypes()], 316 self.view.getContent(state))) 317 318 def test_getChart(self): 319 """ This test verifies creation of chart image tag.""" 320 chart_tag = """ <imgsrc="http://chart.apis.google.com/chart?chxt=y& 321 chds=0,159&chd=t:156.0,145.0,145.0,0.0|3.0,1.0,0.0, 322 3.0|0.0,0.0,0.0,0.0&chxr=0,0,159&chco=669933, 323 cc9966,993300,ff6633,e8e4e3,a9a486,dcb57e,ffcc99,996633, 324 333300,00ff00&chl=Folder|Document|Event|Topic& 325 chbh=a,10,0&chs=800x375&cht=bvs& 326 chtt=Content+type+by+state&chdl=private|published| 327 No+workflow&chdlp=b"/>""" 328 329 self.loginAsPortalOwner() 330 self.assertEqual(*map(lambda s:''.join(s.split()), 331 [chart_tag, self.view.getChart()])) 332 280 333 def test_suite(): 281 334 from unittest import TestSuite, makeSuite … … 307 360 test_suite.addTest(makeSuite(TestOwnershipByType)) 308 361 test_suite.addTest(makeSuite(TestOwnershipByState)) 362 test_suite.addTest(makeSuite(TestTypeByState)) 309 363 return test_suite 310 364
Note: See TracChangeset
for help on using the changeset viewer.