当前位置: 首页>>代码示例>>Python>>正文


Python service.render函数代码示例

本文整理汇总了Python中taiga.mdrender.service.render函数的典型用法代码示例。如果您正苦于以下问题:Python render函数的具体用法?Python render怎么用?Python render使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了render函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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">&num;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">&num;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\">&quot;test&quot;</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">&quot;test&quot;</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


注:本文中的taiga.mdrender.service.render函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。