Skip to content

Instantly share code, notes, and snippets.

@nicferrier
Created June 4, 2013 08:14
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save nicferrier/5704385 to your computer and use it in GitHub Desktop.
(require 'ert)
(require 'elwiki)
(require 'fakir)
(ert-deftest elwiki/render-page ()
"Test `elwiki/render-page'."
(fakir-mock-process :httpcon ()
(let ((elwiki-wikiroot "/path/to/wikiroot/")
(test-file-contents "= Test page =\nthis is a test wiki page\n")
(output ""))
(fakir-mock-file
(fakir-file
:filename "test.creole"
:directory "/path/to/wikiroot/wiki"
:content test-file-contents)
(elwiki/render-page
:httpcon
"/path/to/wikiroot/wiki/test.creole"
nil))
(noflet ((elnode-http-send-string (httpcon data)
(setq output (concat output data))
(funcall this-fn httpcon data)))
(should (string=
"<html>\n<head>
<title>Elwiki: test</title>
<link rel=\"stylesheet\" tyle=\"text/css\" href=\"/static/style.css\"/>
<body>
<h1>test</h1>
<a id='Test-page'></a>
<h1>Test page</h1>
<p>this is a test wiki page</p>
</body>
</html>"
output))))))
F elwiki/render-page
Test `elwiki/render-page'.
(ert-test-failed
((should
(string= "<html>\n<head>\n<title>Elwiki: test</title>\n<link rel=\"stylesheet\" tyle=\"text/css\" href=\"/static/style.css\"/>\n<body>\n<h1>test</h1>\n<a id='Test-page'></a>\n<h1>Test page</h1>\n<p>this is a test wiki page</p>\n</body>\n</html>" output))
:form
(string= "<html>\n<head>\n<title>Elwiki: test</title>\n<link rel=\"stylesheet\" tyle=\"text/css\" href=\"/static/style.css\"/>\n<body>\n<h1>test</h1>\n<a id='Test-page'></a>\n<h1>Test page</h1>\n<p>this is a test wiki page</p>\n</body>\n</html>" "")
:value nil))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment