def cmfCreateNews(self, parent_url): # return the doc_url lipsum = Lipsum() doc_id = lipsum.getUniqWord().lower() params = [["type_name", "News Item"], ["id", doc_id], ["add", "Add"]] self.post("%s/folder_factories" % parent_url, params, description="Create an empty news") params = [["allow_discussion", "default"], ["title", lipsum.getSubject()], ["description:text", lipsum.getParagraph()], ["subject:lines", lipsum.getWord()], ["format", "text/plain"], ["change_and_view", "Change and View"]] doc_url = "%s/%s" % (parent_url, doc_id) self.post("%s/metadata_edit_form" % doc_url, params, description="Set metadata") self.assert_('Metadata changed.' in self.getBody()) params = [["text_format", "plain"], ["description:text", lipsum.getParagraph()], ["text:text", lipsum.getMessage()], ["change_and_view", "Change and View"]] self.post("%s/newsitem_edit_form" % doc_url, params, description="Set news content") self.assert_('News Item changed.' in self.getBody()) return doc_url
def test_exampleGuestBook(self): server_url = self.zope_url self.get("%s/Examples/GuestBook" % server_url) server_url = self.zope_url self.setBasicAuth(self.admin_id, self.admin_pwd) lipsum = Lipsum() self.get("%s/Examples/GuestBook/addEntry.html" % server_url) params = [["guest_name", lipsum.getWord().capitalize()], ["comments", lipsum.getParagraph()]] self.post("%s/Examples/GuestBook/addEntry" % server_url, params) self.clearBasicAuth()