Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

refactor: Rename remaining bugdown words to markdown in test_markdown.py.

Mohit Gupta4224ac1b617e
diff --git a/docs/subsystems/markdown.md b/docs/subsystems/markdown.md
index 769a4ca9d17..2bca8944a05 100644
--- a/docs/subsystems/markdown.md
+++ b/docs/subsystems/markdown.md
@@ -79,7 +79,7 @@ testcases in `markdown_test_cases.json` that you want to ignore. This
is a workaround due to lack of comments support in JSON. Revert your
"ignore" changes before committing. After this, you can run the frontend
tests with `tools/test-js-with-node markdown` and backend tests with
-`tools/test-backend zerver.tests.test_markdown.BugdownTest.test_bugdown_fixtures`.
+`tools/test-backend zerver.tests.test_markdown.MarkdownTest.test_markdown_fixtures`.
## Changing Zulip's markdown processor
diff --git a/docs/testing/testing.md b/docs/testing/testing.md
index 18283542a08..69fb24a49d8 100644
--- a/docs/testing/testing.md
+++ b/docs/testing/testing.md
@@ -33,8 +33,8 @@ typically involve running subsets of the tests with commands like these:
```
./tools/lint zerver/lib/actions.py # Lint the file you just changed
-./tools/test-backend zerver.tests.test_markdown.BugdownTest.test_inline_youtube
-./tools/test-backend BugdownTest # Run `test-backend --help` for more options
+./tools/test-backend zerver.tests.test_markdown.MarkdownTest.test_inline_youtube
+./tools/test-backend MarkdownTest # Run `test-backend --help` for more options
./tools/test-js-with-casper 09-navigation.js
./tools/test-js-with-node utils.js
```
diff --git a/tools/test-backend b/tools/test-backend
index a4073d03482..004629c8e27 100755
--- a/tools/test-backend
+++ b/tools/test-backend
@@ -70,7 +70,7 @@ not_yet_fully_covered = {path for target in [
'zerver/lib/send_email.py',
'zerver/lib/url_preview/preview.py',
'zerver/worker/queue_processors.py',
- # Bugdown sub-libs should have full coverage too; a lot are really close
+ # Markdown sub-libs should have full coverage too; a lot are really close
'zerver/lib/markdown/api_arguments_table_generator.py',
'zerver/lib/markdown/fenced_code.py',
'zerver/lib/markdown/help_relative_links.py',
@@ -199,10 +199,10 @@ def main() -> None:
test-backend zerver.tests.test_markdown # run all tests in a test module
test-backend zerver/tests/test_markdown.py # run all tests in a test module
test-backend test_markdown # run all tests in a test module
- test-backend zerver.tests.test_markdown.BugdownTest # run all tests in a test class
- test-backend BugdownTest # run all tests in a test class
- test-backend zerver.tests.test_markdown.BugdownTest.test_inline_youtube # run a single test
- test-backend BugdownTest.test_inline_youtube # run a single test"""
+ test-backend zerver.tests.test_markdown.MarkdownTest # run all tests in a test class
+ test-backend MarkdownTest # run all tests in a test class
+ test-backend zerver.tests.test_markdown.MarkdownTest.test_inline_youtube # run a single test
+ test-backend MarkdownTest.test_inline_youtube # run a single test"""
parser = argparse.ArgumentParser(description=usage,
formatter_class=argparse.RawTextHelpFormatter)
diff --git a/zerver/tests/test_markdown.py b/zerver/tests/test_markdown.py
index 606e191f74c..729858e2f0b 100644
--- a/zerver/tests/test_markdown.py
+++ b/zerver/tests/test_markdown.py
@@ -192,7 +192,7 @@ def markdown_convert(content: str) -> str:
message_realm=get_realm('zulip'),
)
-class BugdownMiscTest(ZulipTestCase):
+class MarkdownMiscTest(ZulipTestCase):
def test_diffs_work_as_expected(self) -> None:
str1 = "<p>The quick brown fox jumps over the lazy dog. Animal stories are fun, yeah</p>"
str2 = "<p>The fast fox jumps over the lazy dogs and cats. Animal stories are fun</p>"
@@ -357,7 +357,7 @@ Outside. Should convert:<>
original, expected = self.split_message(msg)
self.assertEqual(preprocessor.run(original), expected)
-class BugdownTest(ZulipTestCase):
+class MarkdownTest(ZulipTestCase):
def setUp(self) -> None:
super().setUp()
clear_state_for_testing()
@@ -370,7 +370,7 @@ class BugdownTest(ZulipTestCase):
else:
super().assertEqual(first, second)
- def load_bugdown_tests(self) -> Tuple[Dict[str, Any], List[List[str]]]:
+ def load_markdown_tests(self) -> Tuple[Dict[str, Any], List[List[str]]]:
test_fixtures = {}
with open(os.path.join(os.path.dirname(__file__), 'fixtures/markdown_test_cases.json')) as f:
data = ujson.load(f)
@@ -379,17 +379,17 @@ class BugdownTest(ZulipTestCase):
return test_fixtures, data['linkify_tests']
- def test_bugdown_no_ignores(self) -> None:
+ def test_markdown_no_ignores(self) -> None:
# We do not want any ignored tests to be committed and merged.
- format_tests, linkify_tests = self.load_bugdown_tests()
+ format_tests, linkify_tests = self.load_markdown_tests()
for name, test in format_tests.items():
message = f'Test "{name}" shouldn\'t be ignored.'
is_ignored = test.get('ignore', False)
self.assertFalse(is_ignored, message)
@slow("Aggregate of runs dozens of individual markdown tests")
- def test_bugdown_fixtures(self) -> None:
- format_tests, linkify_tests = self.load_bugdown_tests()
+ def test_markdown_fixtures(self) -> None:
+ format_tests, linkify_tests = self.load_markdown_tests()
valid_keys = {"name", "input", "expected_output",
"backend_only_rendering",
"marked_expected_output", "text_content",
@@ -423,7 +423,7 @@ class BugdownTest(ZulipTestCase):
href = 'http://' + url
return payload % (f"<a href=\"{href}\">{url}</a>",)
- print("Running Bugdown Linkify tests")
+ print("Running Markdown Linkify tests")
with mock.patch('zerver.lib.url_preview.preview.link_embed_data_from_cache', return_value=None):
for inline_url, reference, url in linkify_tests:
try:
@@ -887,7 +887,7 @@ class BugdownTest(ZulipTestCase):
realm = get_realm('zulip')
- # Needs to mock an actual message because that's how bugdown obtains the realm
+ # Needs to mock an actual message because that's how markdown obtains the realm
msg = Message(sender=self.example_user('hamlet'))
converted = convert(":green_tick:", message_realm=realm, message=msg)
realm_emoji = RealmEmoji.objects.filter(realm=realm,
@@ -1011,7 +1011,7 @@ class BugdownTest(ZulipTestCase):
assert_conversion('Hello #123World', False)
assert_conversion('Hello#123 World', False)
assert_conversion('Hello#123World', False)
- # Ideally, these should be converted, but bugdown doesn't
+ # Ideally, these should be converted, but markdown doesn't
# handle word boundary detection in languages that don't use
# whitespace for that correctly yet.
assert_conversion('チケットは#123です', False)
@@ -2079,7 +2079,7 @@ class BugdownTest(ZulipTestCase):
converted = markdown_convert(dedent(msg))
self.assertEqual(converted, dedent(expected_output))
-class BugdownApiTests(ZulipTestCase):
+class MarkdownApiTests(ZulipTestCase):
def test_render_message_api(self) -> None:
content = 'That is a **bold** statement'
result = self.api_post(
@@ -2105,8 +2105,8 @@ class BugdownApiTests(ZulipTestCase):
self.assertEqual(result.json()['rendered'],
f'<p>This mentions <a class="stream" data-stream-id="{stream_id}" href="/#narrow/stream/{stream_id}-Denmark">#Denmark</a> and <span class="user-mention" data-user-id="{user_id}">@King Hamlet</span>.</p>')
-class BugdownErrorTests(ZulipTestCase):
- def test_bugdown_error_handling(self) -> None:
+class MarkdownErrorTests(ZulipTestCase):
+ def test_markdown_error_handling(self) -> None:
with self.simulated_markdown_failure():
with self.assertRaises(MarkdownRenderingException):
markdown_convert('')
@@ -2175,7 +2175,7 @@ class BugdownErrorTests(ZulipTestCase):
result = processor.run(markdown_input)
self.assertEqual(result, expected)
-class BugdownAvatarTestCase(ZulipTestCase):
+class MarkdownAvatarTestCase(ZulipTestCase):
def test_possible_avatar_emails(self) -> None:
content = '''
hello !avatar([email protected]) my email is [email protected]