- Timestamp:
- 15 Dec 2014, 06:22:18 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests/test_browser.py
r12226 r12237 99 99 # Tests for document related views and pages 100 100 101 def test_manage_ document(self):101 def test_manage_file_document(self): 102 102 # Managers can access the pages of documentsconter 103 103 # and can perform actions … … 194 194 'INFO - zope.mgr - documents.browser.DocumentsContainerManageFormPage - removed: %s' 195 195 % document.document_id in logcontent) 196 197 def test_manage_html_document(self): 198 # Managers can access the pages of documentsconter 199 # and can perform actions 200 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 201 self.browser.open('http://localhost/app') 202 self.assertEqual(self.browser.headers['Status'], '200 Ok') 203 self.browser.getLink("Documents").click() 204 self.assertEqual(self.browser.url, self.container_path) 205 self.browser.getLink("Manage").click() 206 self.browser.getControl("Add document").click() 207 self.browser.getControl(name="doctype").value = ['HTMLDocument'] 208 self.browser.getControl(name="form.title").value = 'My HTML Document' 209 self.browser.getControl("Add document").click() 210 self.assertTrue('HTML Document added.' in self.browser.contents) 211 document = self.app['documents']['d101'] 212 213 # Document can be edited 214 self.browser.getLink("d101").click() 215 self.browser.getLink("Manage").click() 216 self.browser.getControl(name="form.title").value = 'My second doc' 217 self.browser.getControl(name="form.html_multilang").value = """ 218 <h1>Hello World</h1> 219 """ 220 self.browser.getControl("Save").click() 221 self.assertTrue('Form has been saved.' in self.browser.contents) 222 self.browser.getLink("View").click() 223 self.assertEqual(self.browser.url, self.container_path + '/d101/index') 224 self.assertTrue( 225 '<h1>Hello World</h1>' in self.browser.contents) 226 227 # Transitions can be performed 228 self.browser.open(self.container_path + '/d101') 229 self.browser.getLink("Transition").click() 230 self.browser.getControl(name="transition").value = ['publish'] 231 self.browser.getControl("Save").click() 232 self.assertEqual(document.state, 'published') 233 234 # Documents can be removed 235 self.browser.getLink("Documents").click() 236 self.browser.getLink("Manage").click() 237 ctrl = self.browser.getControl(name='val_id') 238 ctrl.getControl(value=document.document_id).selected = True 239 self.browser.getControl("Remove selected", index=0).click() 240 self.assertTrue('Successfully removed' in self.browser.contents) 241 242 # All actions are being logged 243 logfile = os.path.join( 244 self.app['datacenter'].storage, 'logs', 'main.log') 245 logcontent = open(logfile).read() 246 247 self.assertTrue( 248 'INFO - zope.mgr - %s - Document created' % document.document_id 249 in logcontent) 250 self.assertTrue( 251 'INFO - zope.mgr - documents.browser.DocumentAddFormPage - added: HTML Document %s' 252 % document.document_id in logcontent) 253 self.assertTrue( 254 'INFO - zope.mgr - documents.browser.HTMLDocumentManageFormPage - %s - saved: title + html_multilang' 255 % document.document_id in logcontent) 256 self.assertTrue( 257 'INFO - zope.mgr - %s - Document published' % document.document_id 258 in logcontent) 259 self.assertTrue( 260 'INFO - zope.mgr - documents.browser.DocumentsContainerManageFormPage - removed: %s' 261 % document.document_id in logcontent) 262
Note: See TracChangeset for help on using the changeset viewer.