Changeset 12256 for main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests
- Timestamp:
- 18 Dec 2014, 12:58:12 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests/test_browser.py
r12246 r12256 111 111 self.browser.getControl(name="doctype").value = ['PDFDocument'] 112 112 self.browser.getControl(name="form.title").value = 'My PDF Document' 113 self.browser.getControl(name="form.document_id").value = 'DOC1' 113 114 self.browser.getControl("Add document").click() 114 115 self.assertTrue('PDF Document added.' in self.browser.contents) 115 document = self.app['documents'][' d101']116 document = self.app['documents']['DOC1'] 116 117 117 118 # Document can be edited 118 self.browser.getLink(" d101").click()119 self.browser.getLink("DOC1").click() 119 120 self.browser.getLink("Manage").click() 120 121 self.browser.getControl(name="form.title").value = 'My first doc' … … 122 123 self.assertTrue('Form has been saved.' in self.browser.contents) 123 124 self.browser.getLink("View").click() 124 self.assertEqual(self.browser.url, self.container_path + '/ d101/index')125 self.assertEqual(self.browser.url, self.container_path + '/DOC1/index') 125 126 126 127 # File can be uploaded … … 149 150 name='upload_pdfscanmanageupload').click() 150 151 self.assertTrue( 151 'href="http://localhost/app/documents/ d101/sample.pdf">PDF File</a>'152 'href="http://localhost/app/documents/DOC1/sample.pdf">PDF File</a>' 152 153 in self.browser.contents) 153 154 # Browsing the link shows a real pdf only if the document … … 158 159 in self.browser.contents) 159 160 IWorkflowState(document).setState(PUBLISHED) 160 self.browser.open(self.container_path + '/ d101/sample.pdf')161 self.browser.open(self.container_path + '/DOC1/sample.pdf') 161 162 self.assertEqual( 162 163 self.browser.headers['content-type'], 'application/pdf') … … 164 165 # Transitions can be performed 165 166 self.assertEqual(document.state, 'published') 166 self.browser.open(self.container_path + '/ d101')167 self.browser.open(self.container_path + '/DOC1') 167 168 self.browser.getLink("Transition").click() 168 169 self.browser.getControl(name="transition").value = ['retract'] … … 213 214 self.browser.getControl("Add document").click() 214 215 self.browser.getControl(name="doctype").value = ['HTMLDocument'] 216 self.browser.getControl(name="form.document_id").value = 'DOC2' 215 217 self.browser.getControl(name="form.title").value = 'My HTML Document' 216 218 self.browser.getControl("Add document").click() 217 219 self.assertTrue('HTML Document added.' in self.browser.contents) 218 document = self.app['documents'][' d101']220 document = self.app['documents']['DOC2'] 219 221 220 222 # Document can be edited 221 self.browser.getLink(" d101").click()223 self.browser.getLink("DOC2").click() 222 224 self.browser.getLink("Manage").click() 223 225 self.browser.getControl(name="form.title").value = 'My second doc' … … 230 232 self.assertTrue('Form has been saved.' in self.browser.contents) 231 233 self.browser.getLink("View").click() 232 self.assertEqual(self.browser.url, self.container_path + '/ d101/index')234 self.assertEqual(self.browser.url, self.container_path + '/DOC2/index') 233 235 self.assertTrue( 234 236 '<h1>Hello World</h1>' in self.browser.contents) … … 241 243 '<h1>Hallo Welt</h1>' in self.browser.contents) 242 244 # The content can't be rendered yet 243 self.browser.open(self.container_path + '/ d101/display')245 self.browser.open(self.container_path + '/DOC2/display') 244 246 self.assertTrue( 245 247 'The document requested has not yet been published' … … 249 251 250 252 # Transitions can be performed 251 self.browser.open(self.container_path + '/ d101')253 self.browser.open(self.container_path + '/DOC2') 252 254 self.browser.getLink("Transition").click() 253 255 self.browser.getControl(name="transition").value = ['publish'] … … 256 258 257 259 # The content can be rendered 258 self.browser.open(self.container_path + '/ d101/display')260 self.browser.open(self.container_path + '/DOC2/display') 259 261 self.assertTrue( 260 262 '<h1>Hallo Welt</h1>' in self.browser.contents) -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests/test_document.py
r12213 r12256 72 72 container = DocumentsContainer() 73 73 document = createObject(u'waeup.HTMLDocument') 74 document _id = document.document_id74 document.document_id = u'DOC' 75 75 container.addDocument(document) 76 self.assertEqual(container[document _id], document)76 self.assertEqual(container[document.document_id], document) 77 77 self.assertRaises(TypeError, container.addDocument, object()) 78 self.assertEqual(document _id, 'd123')78 self.assertEqual(document.document_id, 'DOC') 79 79 return 80 80 … … 151 151 # we can get an image filename for documents not in a container 152 152 doc = PDFDocument() 153 doc.document_id = u'DOC' 153 154 chooser = IFileStoreNameChooser(doc) 154 155 result = chooser.chooseName('sample.jpg') 155 156 # the file would be stored in a ``_default`` directory. 156 157 self.assertEqual( 157 result, '__file-document__documents/sample_ d123.jpg')158 result, '__file-document__documents/sample_DOC.jpg') 158 159 return
Note: See TracChangeset for help on using the changeset viewer.