Example #1
0
File: tests.py Project: tzwenn/1327
	def test_url_shows_document(self):
		title = "Document title"
		text = "This is the document text."
		author = self.user
		document = InformationDocument(title=title, text=text, author=author)
		document.save()

		assign_perm(InformationDocument.VIEW_PERMISSION_NAME, author, document)
		self.assertTrue(author.has_perm(InformationDocument.VIEW_PERMISSION_NAME, document))

		self.assertTrue(document.get_view_url(), msg="InformationDocument should return a URL")

		response = self.app.get(document.get_view_url(), user=author)

		self.assertIn(title.encode("utf-8"), response.body, msg="The displayed page should contain the document's title")