Show More
@@ -1,35 +1,35 b'' | |||||
1 | from django.test import TestCase |
|
1 | from django.test import TestCase | |
2 | from boards.mdx_neboard import Parser |
|
2 | from boards.mdx_neboard import Parser | |
3 | from boards.models import Post |
|
3 | from boards.models import Post | |
4 |
|
4 | |||
5 |
|
5 | |||
6 | class ParserTest(TestCase): |
|
6 | class ParserTest(TestCase): | |
7 | def test_preparse_quote(self): |
|
7 | def test_preparse_quote(self): | |
8 | raw_text = '>quote\nQuote in >line\nLine\n>Quote' |
|
8 | raw_text = '>quote\nQuote in >line\nLine\n>Quote' | |
9 | preparsed_text = Parser().preparse(raw_text) |
|
9 | preparsed_text = Parser().preparse(raw_text) | |
10 |
|
10 | |||
11 | self.assertEqual( |
|
11 | self.assertEqual( | |
12 | '[quote]quote[/quote]\nQuote in >line\nLine\n[quote]Quote[/quote]', |
|
12 | '[quote]quote[/quote]\nQuote in >line\nLine\n[quote]Quote[/quote]', | |
13 | preparsed_text, 'Quote not preparsed.') |
|
13 | preparsed_text, 'Quote not preparsed.') | |
14 |
|
14 | |||
15 | def test_preparse_comment(self): |
|
15 | def test_preparse_comment(self): | |
16 | raw_text = '//comment' |
|
16 | raw_text = '//comment' | |
17 | preparsed_text = Parser().preparse(raw_text) |
|
17 | preparsed_text = Parser().preparse(raw_text) | |
18 |
|
18 | |||
19 | self.assertEqual('[comment]comment[/comment]', preparsed_text, |
|
19 | self.assertEqual('[comment]comment[/comment]', preparsed_text, | |
20 | 'Comment not preparsed.') |
|
20 | 'Comment not preparsed.') | |
21 |
|
21 | |||
22 | def test_preparse_reflink(self): |
|
22 | def test_preparse_reflink(self): | |
23 | raw_text = '>>12\nText' |
|
23 | raw_text = '>>12\nText' | |
24 | preparsed_text = Parser().preparse(raw_text) |
|
24 | preparsed_text = Parser().preparse(raw_text) | |
25 |
|
25 | |||
26 | self.assertEqual('[post]12[/post]\nText', |
|
26 | self.assertEqual('[post]12[/post]\nText', | |
27 | preparsed_text, 'Reflink not preparsed.') |
|
27 | preparsed_text, 'Reflink not preparsed.') | |
28 |
|
28 | |||
29 | def preparse_user(self): |
|
29 | def test_preparse_user(self): | |
30 | raw_text = '@user\nuser@example.com\n@user\nuser @user' |
|
30 | raw_text = '@user\nuser@example.com\n@user\nuser @user' | |
31 | preparsed_text = Parser().preparse(raw_text) |
|
31 | preparsed_text = Parser().preparse(raw_text) | |
32 |
|
32 | |||
33 | self.assertEqual('[user]user[/user]\nuser@example.com\n[user]user[/user]\nuser [user]user[/user]', |
|
33 | self.assertEqual('[user]user[/user]\nuser@example.com\n[user]user[/user]\nuser [user]user[/user]', | |
34 | preparsed_text, 'User link not preparsed.') |
|
34 | preparsed_text, 'User link not preparsed.') | |
35 |
|
35 |
General Comments 0
You need to be logged in to leave comments.
Login now