diff --git a/tests/test_progit_flask_ui_app.py b/tests/test_progit_flask_ui_app.py index fa31618..512c33a 100644 --- a/tests/test_progit_flask_ui_app.py +++ b/tests/test_progit_flask_ui_app.py @@ -222,6 +222,33 @@ class ProgitFlaskApptests(tests.Modeltests): self.assertTrue( '
' in output.data) + def test_markdown_preview(self): + """ Test the markdown_preview endpoint. """ + + data = { + 'content': 'test\n----\n\n * 1\n * item 2' + } + + output = self.app.post( + '/markdown/', data=data) + self.assertEqual(output.status_code, 302) + self.assertTrue( + '

You should be redirected automatically to target URL: ' + '' + '/login/?next=http%3A%2F%2Flocalhost%2Fmarkdown%2F. ' + 'If not click the link.' in output.data) + + user = tests.FakeUser() + with tests.user_set(progit.APP, user): + output = self.app.post('/markdown/', data=data) + self.assertEqual(output.status_code, 200) + exp = """

test

+""" + self.assertEqual(output.data, exp) + if __name__ == '__main__': SUITE = unittest.TestLoader().loadTestsFromTestCase(ProgitFlaskApptests)