Changeset 3169 in products for quintagroup.analytics/trunk/quintagroup/analytics/tests.py
- Timestamp:
- Apr 21, 2011 2:53:26 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.analytics/trunk/quintagroup/analytics/tests.py
r3043 r3169 17 17 18 18 ptc.setupPloneSite() 19 19 20 20 21 class Installed(PloneSite): … … 41 42 pass 42 43 44 43 45 class SetUpContent(Installed): 44 46 45 47 max = 10 46 48 types_ = ['Document', 'Event', 'Folder'] 47 users = [('user%s' %i, 'user%s'%i, 'Member', None)49 users = [('user%s' % i, 'user%s' % i, 'Member', None) 48 50 for i in xrange(max)] 49 51 … … 71 73 user = user.__of__(uf) 72 74 newSecurityManager(None, user) 73 for i in xrange(users.index(u)+cls.max): 74 map(folder.invokeFactory, cls.types_, [t+str(i) for t in cls.types_]) 75 for i in xrange(users.index(u) + cls.max): 76 map(folder.invokeFactory, cls.types_, 77 [t + str(i) for t in cls.types_]) 75 78 transaction.commit() 76 77 79 78 80 @classmethod … … 87 89 pass 88 90 91 89 92 class TestCase(ptc.PloneTestCase): 90 93 layer = Installed … … 99 102 """This test validates control panel action. """ 100 103 control_panel = self.portal.portal_controlpanel 101 self.assert_('QAnalytics' in [a.id for a in control_panel.listActions()], 102 "Configlet for quintagroup.analitycs isn't registered.") 104 self.assert_( 105 'QAnalytics' in [a.id for a in control_panel.listActions()], 106 "Configlet for quintagroup.analitycs isn't registered.") 103 107 104 108 def test_OwnershipByType(self): … … 147 151 self.assert_(view, "Properties Stats view isn't registered") 148 152 149 150 153 def test_PortletsStats(self): 151 154 """ This test validates registration of … … 156 159 157 160 self.assert_(view, "Portlets Stats view isn't registered") 161 158 162 159 163 class TestOwnershipByType(TestCase): … … 171 175 users = [u[0] for u in self.layer.users] 172 176 users.reverse() 173 self.assert_(False not in map(lambda u1, u2: u1==u2,177 self.assert_(False not in map(lambda u1, u2: u1 == u2, 174 178 users, self.view.getUsers())) 175 179 … … 190 194 data.reverse() 191 195 types = [i[0] for i in data] 192 self.assert_(False not in map(lambda t1, t2: t1==t2,196 self.assert_(False not in map(lambda t1, t2: t1 == t2, 193 197 self.view.getTypes(), types)) 194 198 … … 204 208 for type_ in self.layer.types_: 205 209 self.assert_(False not in \ 206 map(lambda i, j:i==j, [len(self.pc(portal_type=type_, Creator=user)) 210 map(lambda i, j: i == j, [len(self.pc(portal_type=type_, 211 Creator=user)) 207 212 for user in self.view.getUsers()], 208 213 self.view.getContent(type_))) … … 216 221 19.0,18.0,17.0,16.0,15.0,14.0,13.0,12.0,11.0,10.0|0.0, 217 222 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0|0.0,0.0,0.0,0.0, 218 0.0,0.0,0.0,0.0,0.0,0.0&chxr=0,0,57&chco=669933,cc9966, 219 993300,ff6633,e8e4e3,a9a486,dcb57e,ffcc99,996633,333300,00ff00& 223 0.0,0.0,0.0,0.0,0.0,0.0&chxr=0,0,57& 224 chco=669933,cc9966,993300,ff6633,e8e4e3,a9a486, 225 dcb57e,ffcc99,996633,333300,00ff00& 220 226 chl=user9|user8|user7|user6|user5|user4|user3|user2|user1| 221 227 user0&chbh=a,10,0&chs=800x375&cht=bvs& … … 239 245 240 246 self.loginAsPortalOwner() 241 self.assertEqual(*map(lambda s: ''.join(s.split()),247 self.assertEqual(*map(lambda s: ''.join(s.split()), 242 248 [chart_tag, self.view.getChart()])) 249 243 250 244 251 class TestOwnershipByState(TestCase): … … 258 265 users = [u[0] for u in self.layer.users] 259 266 users.reverse() 260 self.assert_(False not in map(lambda u1, u2: u1==u2,267 self.assert_(False not in map(lambda u1, u2: u1 == u2, 261 268 users, self.view.getUsers())) 262 269 263 270 def test_getStates(self): 264 271 """ Tests method that returns ordered list of states.""" 265 self.assert_(False not in map(lambda s1, s2: s1==s2,272 self.assert_(False not in map(lambda s1, s2: s1 == s2, 266 273 ['private', 'published'], self.view.getStates())) 267 274 … … 277 284 for state in self.states: 278 285 self.assert_(False not in \ 279 map(lambda i, j:i==j,[len(self.pc(review_state=state, Creator=user)) 286 map(lambda i, j: i == j, [len(self.pc(review_state=state, 287 Creator=user)) 280 288 for user in self.view.getUsers()], 281 289 self.view.getContent(state))) … … 294 302 published|No+workflow&chdlp=b"/>""" 295 303 self.loginAsPortalOwner() 296 self.assertEqual(*map(lambda s: ''.join(s.split()),304 self.assertEqual(*map(lambda s: ''.join(s.split()), 297 305 [chart_tag, self.view.getChart()])) 306 298 307 299 308 class TestTypeByState(TestCase): … … 323 332 data.reverse() 324 333 types = [i[0] for i in data] 325 self.assert_(False not in map(lambda t1, t2: t1==t2, types,334 self.assert_(False not in map(lambda t1, t2: t1 == t2, types, 326 335 self.view.getTypes())) 327 336 328 337 def test_getStates(self): 329 338 """ Tests method that returns ordered list of states.""" 330 self.assert_(False not in map(lambda s1, s2: s1==s2,339 self.assert_(False not in map(lambda s1, s2: s1 == s2, 331 340 ['private', 'published'], self.view.getStates())) 332 341 … … 342 351 for state in self.states: 343 352 self.assert_(False not in \ 344 map(lambda i, j: i==j, [len(self.pc(portal_type=type_,353 map(lambda i, j: i == j, [len(self.pc(portal_type=type_, 345 354 review_state=state)) 346 355 for type_ in self.view.getTypes()], … … 373 382 374 383 self.loginAsPortalOwner() 375 self.assertEqual(*map(lambda s: ''.join(s.split()),384 self.assertEqual(*map(lambda s: ''.join(s.split()), 376 385 [chart_tag, self.view.getChart()])) 386 377 387 378 388 class LegacyPortlets(TestCase): 379 389 """Test all legasy_portlets view methods.""" 380 390 381 382 391 def afterSetUp(self): 383 392 self.view = queryMultiAdapter((self.portal, self.portal.REQUEST), … … 395 404 # this is true for Plone 4 396 405 self.assert_(self.view.getAllPortletExpressions() == []) 406 397 407 398 408 class TestPropertiesStats(TestCase): … … 429 439 mapping.restrictedTraverse('+/' + portlet.addview)() 430 440 431 plone_portlets_info = filter(lambda info: info['path'] == '/plone',441 plone_portlets_info = filter(lambda info: info['path'] == '/plone', 432 442 self.view.getPropsList()) 433 443 lslots = plone_portlets_info[0]['left_slots']
Note: See TracChangeset
for help on using the changeset viewer.