本文整理汇总了Python中taiga.mdrender.service.render函数的典型用法代码示例。如果您正苦于以下问题:Python render函数的具体用法?Python render怎么用?Python render使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了render函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_proccessor_invalid_type_reference
def test_proccessor_invalid_type_reference():
with patch("taiga.mdrender.extensions.references.get_instance_by_ref") as mock:
instance = mock.return_value
instance.content_type.model = "other"
instance.content_object.subject = "test"
result = render(dummy_project, "**#4**")
assert result == "<p><strong>#4</strong></p>"
开发者ID:74Labs,项目名称:taiga-back,代码行数:7,代码来源:test_mdrender.py
示例2: test_proccessor_valid_issue_reference
def test_proccessor_valid_issue_reference():
with patch("taiga.mdrender.extensions.references.get_instance_by_ref") as mock:
instance = mock.return_value
instance.content_type.model = "issue"
instance.content_object.subject = "test"
result = render(dummy_project, "**#2**")
expected_result = '<p><strong><a alt="test" class="reference issue" href="/#/project/test/issues/2" title="test">#2</a></strong></p>'
assert result == expected_result
开发者ID:yamila-moreno,项目名称:taiga-back,代码行数:8,代码来源:test_mdrender.py
示例3: test_proccessor_valid_us_reference
def test_proccessor_valid_us_reference():
with patch("taiga.mdrender.extensions.references.get_instance_by_ref") as mock:
instance = mock.return_value
instance.content_type.model = "userstory"
instance.content_object.subject = "test"
result = render(dummy_project, "**#1**")
expected_result = '<p><strong><a alt="test" class="reference user-story" href="http://localhost:9001/project/test/us/1" title="test">#1</a></strong></p>'
assert result == expected_result
开发者ID:6ft,项目名称:taiga-back,代码行数:8,代码来源:test_mdrender.py
示例4: test_proccessor_valid_task_reference
def test_proccessor_valid_task_reference():
with patch("taiga.mdrender.extensions.references.get_instance_by_ref") as mock:
instance = mock.return_value
instance.content_type.model = "task"
instance.content_object.subject = "test"
result = render(dummy_project, "**#3**")
expected_result = '<p><strong><a class="reference task" href="http://localhost:9001/project/test/task/3" title="#3 test">#3</a></strong></p>'
assert result == expected_result
开发者ID:74Labs,项目名称:taiga-back,代码行数:8,代码来源:test_mdrender.py
示例5: test_mentions_valid_username_with_dash
def test_mentions_valid_username_with_dash():
with patch("taiga.mdrender.extensions.mentions.get_user_model") as get_user_model_mock:
dummy_uuser = MagicMock()
dummy_uuser.get_full_name.return_value = "Ginny Weasley"
get_user_model_mock.return_value.objects.get = MagicMock(return_value=dummy_uuser)
result = render(dummy_project, "text @super-ginny text")
get_user_model_mock.return_value.objects.get.assert_called_with(username="super-ginny")
assert result == ('<p>text <a class="mention" href="http://localhost:9001/profile/super-ginny" '
'title="Ginny Weasley">@super-ginny</a> text</p>')
开发者ID:taigaio,项目名称:taiga-back,代码行数:11,代码来源:test_mdrender.py
示例6: test_mentions_valid_username_with_points
def test_mentions_valid_username_with_points():
with patch("taiga.mdrender.extensions.mentions.get_user_model") as get_user_model_mock:
dummy_uuser = MagicMock()
dummy_uuser.get_full_name.return_value = "Luna Lovegood"
get_user_model_mock.return_value.objects.get = MagicMock(return_value=dummy_uuser)
result = render(dummy_project, "text @luna.lovegood text")
get_user_model_mock.return_value.objects.get.assert_called_with(username="luna.lovegood")
assert result == ('<p>text <a class="mention" href="http://localhost:9001/profile/luna.lovegood" '
'title="Luna Lovegood">@luna.lovegood</a> text</p>')
开发者ID:taigaio,项目名称:taiga-back,代码行数:11,代码来源:test_mdrender.py
示例7: test_mentions_valid_username
def test_mentions_valid_username():
with patch("taiga.mdrender.extensions.mentions.get_user_model") as get_user_model_mock:
dummy_uuser = MagicMock()
dummy_uuser.get_full_name.return_value = "Hermione Granger"
get_user_model_mock.return_value.objects.get = MagicMock(return_value=dummy_uuser)
result = render(dummy_project, "text @hermione text")
get_user_model_mock.return_value.objects.get.assert_called_with(username="hermione")
assert result == ('<p>text <a class="mention" href="http://localhost:9001/profile/hermione" '
'title="Hermione Granger">@hermione</a> text</p>')
开发者ID:taigaio,项目名称:taiga-back,代码行数:11,代码来源:test_mdrender.py
示例8: test_render_reference_links
def test_render_reference_links():
expected_result = "<p>An <a href=\"http://example.com/\" target=\"_blank\" title=\"Title\">example</a> of reference link</p>"
source = "An [example][id] of reference link\n [id]: http://example.com/ \"Title\""
assert render(dummy_project, source) == expected_result
开发者ID:74Labs,项目名称:taiga-back,代码行数:4,代码来源:test_mdrender.py
示例9: test_render_wikilink_relative_to_absolute
def test_render_wikilink_relative_to_absolute():
expected_result = "<p><a href=\"http://localhost:9001/project/test/\">test project</a></p>"
assert render(dummy_project, "[test project](/project/test/)") == expected_result
开发者ID:74Labs,项目名称:taiga-back,代码行数:3,代码来源:test_mdrender.py
示例10: test_render_triple_quote_code
def test_render_triple_quote_code():
expected_result = "<div class=\"codehilite\"><pre><span class=\"n\">print</span><span class=\"p\">(</span><span class=\"s\">"test"</span><span class=\"p\">)</span>\n</pre></div>"
assert render(dummy_project, "```\nprint(\"test\")\n```") == expected_result
开发者ID:yamila-moreno,项目名称:taiga-back,代码行数:3,代码来源:test_mdrender.py
示例11: test_render_triple_quote_and_lang_code
def test_render_triple_quote_and_lang_code():
expected_result = '<div class="codehilite"><pre><span></span><span class="k">print</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>\n</pre></div>'
assert render(dummy_project, "```python\nprint(\"test\")\n```") == expected_result
开发者ID:taigaio,项目名称:taiga-back,代码行数:4,代码来源:test_mdrender.py
示例12: test_render_relative_image
def test_render_relative_image():
assert render(dummy_project, "![test](test.png)") == "<p><img alt=\"test\" src=\"test.png\"></p>"
开发者ID:74Labs,项目名称:taiga-back,代码行数:2,代码来源:test_mdrender.py
示例13: test_render_url_automail
def test_render_url_automail():
expected_result = "<p>Test the <a href=\"mailto:[email protected]\" target=\"_blank\">[email protected]</a> automail</p>"
source = "Test the [email protected] automail"
assert render(dummy_project, source) == expected_result
开发者ID:74Labs,项目名称:taiga-back,代码行数:4,代码来源:test_mdrender.py
示例14: test_proccessor_valid_email
def test_proccessor_valid_email():
result = render(dummy_project, "**[email protected]**")
expected_result = "<p><strong><a href=\"mailto:[email protected]\" target=\"_blank\">[email protected]</a></strong></p>"
assert result == expected_result
开发者ID:heyox,项目名称:taiga-back,代码行数:4,代码来源:test_mdrender.py
示例15: test_proccessor_invalid_user_mention
def test_proccessor_invalid_user_mention():
result = render(dummy_project, "**@notvaliduser**")
assert result == '<p><strong>@notvaliduser</strong></p>'
开发者ID:heyox,项目名称:taiga-back,代码行数:3,代码来源:test_mdrender.py
示例16: test_proccessor_valid_user_mention
def test_proccessor_valid_user_mention():
factories.UserFactory(username="user1", full_name="test name")
result = render(dummy_project, "**@user1**")
expected_result = "<p><strong><a class=\"mention\" href=\"http://localhost:9001/profile/user1\" title=\"test name\">@user1</a></strong></p>"
assert result == expected_result
开发者ID:heyox,项目名称:taiga-back,代码行数:5,代码来源:test_mdrender.py
示例17: test_render_url_autolinks
def test_render_url_autolinks():
expected_result = "<p>Test the <a href=\"http://example.com/\" target=\"_blank\">http://example.com/</a> autolink</p>"
source = "Test the http://example.com/ autolink"
assert render(dummy_project, source) == expected_result
开发者ID:74Labs,项目名称:taiga-back,代码行数:4,代码来源:test_mdrender.py
示例18: mdrender
def mdrender(project, text) -> str:
if text:
return Markup(render(project, text))
return ""
开发者ID:cubettech,项目名称:taiga-back,代码行数:4,代码来源:functions.py
示例19: test_render_url_autolinks_without_http
def test_render_url_autolinks_without_http():
expected_result = "<p>Test the <a href=\"http://www.example.com\" target=\"_blank\">www.example.com</a> autolink</p>"
source = "Test the www.example.com autolink"
assert render(dummy_project, source) == expected_result
开发者ID:74Labs,项目名称:taiga-back,代码行数:4,代码来源:test_mdrender.py
示例20: test_render_wikilink_1
def test_render_wikilink_1():
expected_result = "<p><a class=\"reference wiki\" href=\"http://localhost:9001/project/test/wiki/test\" title=\"test\">test</a></p>"
assert render(dummy_project, "[[test]]") == expected_result
开发者ID:74Labs,项目名称:taiga-back,代码行数:3,代码来源:test_mdrender.py
注:本文中的taiga.mdrender.service.render函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论