Changeset 3017 in products for quintagroup.analytics/trunk/quintagroup/analytics/tests.py
- Timestamp:
- Nov 15, 2010 10:40:10 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.analytics/trunk/quintagroup/analytics/tests.py
r3015 r3017 224 224 [chart_tag, self.view.getChart()])) 225 225 226 226 class TestOwnershipByState(TestCase): 227 """Tests all ownership by state view methods.""" 228 229 layer = SetUpContent 230 231 states = ['private', 'published', 'pending'] 232 233 def afterSetUp(self): 234 self.view = queryMultiAdapter((self.portal, self.portal.REQUEST), 235 name="ownership_by_state") 236 self.pc = self.portal.portal_catalog 237 238 def test_getUsers(self): 239 """ Tests method that returns ordered list of users.""" 240 users = [u[0] for u in self.layer.users] 241 users.reverse() 242 self.assert_(False not in map(lambda u1, u2:u1==u2, 243 users, self.view.getUsers())) 244 245 def test_getStates(self): 246 """ Tests method that returns ordered list of states.""" 247 self.assert_(False not in map(lambda s1, s2:s1==s2, 248 ['private', 'published'], self.view.getStates())) 249 250 def test_getContent(self): 251 """ This test verifies method that returns list of numbers. 252 Each number is amount of specified content type objects 253 that are in particular workflow state. 254 """ 255 # we need to login in to the site as Manager to be able to 256 # see catalog results 257 self.loginAsPortalOwner() 258 259 for state in self.states: 260 self.assert_(False not in \ 261 map(lambda i, j:i==j,[len(self.pc(review_state=state, Creator=user)) 262 for user in self.view.getUsers()], 263 self.view.getContent(state))) 264 265 def test_getChart(self): 266 """ This test verifies creation of chart image tag.""" 267 chart_tag = """<imgsrc="http://chart.apis.google.com/chart?chxt=y& 268 chds=0,57&chd=t:57.0,54.0,51.0,48.0,45.0,42.0,39.0, 269 36.0,33.0,30.0|0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 270 0.0|0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0&chxr=0, 271 0,57&chco=669933,cc9966,993300,ff6633,e8e4e3,a9a486, 272 dcb57e,ffcc99,996633,333300,00ff00&chl=user9|user8| 273 user7|user6|user5|user4|user3|user2|user1|user0& 274 chbh=a,10,0&chs=800x375&cht=bvs& 275 chtt=Content+ownership+by+state&chdl=private| 276 published|No+workflow&chdlp=b"/>""" 277 self.loginAsPortalOwner() 278 self.assertEqual(*map(lambda s:''.join(s.split()), 279 [chart_tag, self.view.getChart()])) 227 280 def test_suite(): 228 281 from unittest import TestSuite, makeSuite … … 253 306 test_suite.addTest(makeSuite(TestQAInstallation)) 254 307 test_suite.addTest(makeSuite(TestOwnershipByType)) 308 test_suite.addTest(makeSuite(TestOwnershipByState)) 255 309 return test_suite 256 310
Note: See TracChangeset
for help on using the changeset viewer.