Changeset 9633 for main/waeup.kofa/trunk/src/waeup/kofa/tests
- Timestamp:
- 14 Nov 2012, 18:40:59 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/tests/test_reports.py
r9511 r9633 25 25 26 26 def __init__(self, name=None, perm_create=None, perm_view=None): 27 self. name = 'Report 1'27 self.title = 'Report 1' 28 28 self.perm_create = perm_create 29 29 self.perm_view = perm_view … … 31 31 32 32 def __eq__(self, obj): 33 if getattr(obj, ' name', None) is None:33 if getattr(obj, 'title', None) is None: 34 34 return False 35 return self. name == obj.name35 return self.title == obj.title 36 36 37 37 def generate(self, site, args=[], kw={}): … … 142 142 self.assertEqual( 143 143 result, 144 [( 'report1', FakeReportGenerator('report1')),145 ( 'report2', FakeReportGenerator('report2'))])144 [(u'report1', FakeReportGenerator('report1')), 145 (u'report2', FakeReportGenerator('report2'))]) 146 146 return 147 147 … … 238 238 job = AsyncReportJob(self.root_folder, 'NOT EXISTENT') 239 239 self.assertEqual( 240 job.description, u' Invalid Report Generator ()')240 job.description, u'Unregistered Report Generator ()') 241 241 # with args set (no kws) 242 242 job = AsyncReportJob( 243 243 self.root_folder, 'NOT EXISTENT', args=['a', 'b']) 244 244 self.assertEqual( 245 job.description, u" Invalid Report Generator ('a', 'b')")245 job.description, u"Unregistered Report Generator ('a', 'b')") 246 246 # with kw set (no args) 247 247 job = AsyncReportJob( 248 248 self.root_folder, 'NOT_EXISTENT', kw=dict(a=1, b=2)) 249 249 self.assertEqual( 250 job.description, u' Invalid Report Generator (a=1, b=2)')250 job.description, u'Unregistered Report Generator (a=1, b=2)') 251 251 # with args and kws set 252 252 job = AsyncReportJob( 253 253 self.root_folder, 'NOT_EXISTENT', args=['a'], kw=dict(b=2)) 254 254 self.assertEqual( 255 job.description, u"Invalid Report Generator ('a', b=2)") 256 return 257 255 job.description, u"Unregistered Report Generator ('a', b=2)") 256 return 258 257 259 258 class FakeJobWithResult(FakeJob): 260 259 261 260 def __init__(self, args=[], kw={}): 262 #self.dir_path = tempfile.mkdtemp()263 #self.result = os.path.join(self.dir_path, 'fake.csv')264 #open(self.result, 'wb').write('a fake result')265 261 self.result = Report() 266 262 self.result.args = args … … 358 354 self.assertEqual( 359 355 result, 360 [('new', u'new', u'Unnamed Report'), 361 ('completed', u'completed', u'Unnamed Report')] 356 [('new', u'new', u'Report 1'), 357 ('completed', u'completed', u'Report 1')] 358 ) 359 return 360 361 def test_get_report_job_description(self): 362 # we can get the descriptions of jobs... 363 container = ReportJobContainer() 364 container.start_report_job('report1', 'alice') 365 container.start_report_job('report1', 'bob') 366 result = container.get_report_jobs_description(user_id='bob') 367 # we'll get the job id, a description and the status 368 self.assertEqual( 369 result, 370 [('2', 'Report 1 ()', u'new'),] 362 371 ) 363 372 return
Note: See TracChangeset for help on using the changeset viewer.