def set_current_document(self, document_id): if document_id is not None: document = self.document_dao.get_by_id(document_id) else: document = Document() document.document_type = DocumentType(1) message = Message(CONF_DOCUMENT_CHANGED, document=document) self.message_broker.send_message(message)
def testNoOverwriting(self): description ='Stadtzeitung vom 23.4.1975. Irgend ein Text' flyer_doc_type = DocumentType(2) flyer_doc_type.description = "Flyer" entity = Document(4711) entity.document_type = flyer_doc_type entity.description = description entity = self.post_processor.run(entity) self.assertTrue(entity.document_type != None) self.assertEqual('Flyer', entity.document_type.description)
def testSaveNewDocument(self): document = Document() document.description = "My description" document.keywords = "My keywords" document.condition = "My document state" document.erfasser = self.injector.get(CreatorDao).get_by_id(2) document.document_type = self.injector.get(DocumentTypeDao).get_by_id( 5) self.dao.save(document) document = self.dao.get_last() self.assertEqual(15, document.id) self.assertEqual("My description", document.description) self.assertEqual("My keywords", document.keywords) self.assertEqual("My document state", document.condition) self.assertEqual(3, document.erfasser.id) self.assertEqual("Flugblatt", document.document_type.description) self.assertTrue(document.change_date) self.assertTrue(document.creation_date)