Created
June 4, 2013 08:14
-
-
Save nicferrier/5704385 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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