Skip to content

Commit

Permalink
change: 修改详情名称
Browse files Browse the repository at this point in the history
  • Loading branch information
he0119 committed Jan 4, 2022
1 parent 8d4781d commit 2a95585
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

POWERED_BY_BOT_MESSAGE = "💪 Powered by NoneBot2 Publish Bot"

DETAIL_MESSAGE_TEMPLATE = (
"<details><summary>详情</summary><pre><code>{detail_message}</code></pre></details>"
)

VALIDATION_MESSAGE_TEMPLATE = """> {publish_info}
**{result}**
Expand Down
3 changes: 2 additions & 1 deletion src/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
BOT_DESC_PATTERN,
BOT_HOMEPAGE_PATTERN,
BOT_NAME_PATTERN,
DETAIL_MESSAGE_TEMPLATE,
PLUGIN_DESC_PATTERN,
PLUGIN_HOMEPAGE_PATTERN,
PLUGIN_MODULE_NAME_PATTERN,
Expand Down Expand Up @@ -424,7 +425,7 @@ def generate_validation_message(info: Union[PublishInfo, MyValidationError]) ->

if len(details) != 0:
detail_message = "".join(details)
detail_message = f"""<details><summary>测试详情</summary><pre><code>{detail_message}</code></pre></details>"""
detail_message = DETAIL_MESSAGE_TEMPLATE.format(detail_message=detail_message)

return VALIDATION_MESSAGE_TEMPLATE.format(
publish_info=publish_info,
Expand Down
4 changes: 2 additions & 2 deletions tests/models/test_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_adapter_info_validation_success(mocker: MockerFixture) -> None:

assert (
info.validation_message
== """> Adapter: name\n\n**✅ 所有测试通过,一切准备就绪!**\n\n<details><summary>测试详情</summary><pre><code><li>✅ 标签: test-#ffffff</li><li>✅ 项目 <a href="https://v2.nonebot.dev">主页</a> 返回状态码 200.</li><li>✅ 包 <a href="https://pypi.org/project/project_link/">project_link</a> 已发布至 PyPI</li></code></pre></details>"""
== """> Adapter: name\n\n**✅ 所有测试通过,一切准备就绪!**\n\n<details><summary>详情</summary><pre><code><li>✅ 标签: test-#ffffff</li><li>✅ 项目 <a href="https://v2.nonebot.dev">主页</a> 返回状态码 200.</li><li>✅ 包 <a href="https://pypi.org/project/project_link/">project_link</a> 已发布至 PyPI</li></code></pre></details>"""
)

calls = [
Expand Down Expand Up @@ -149,7 +149,7 @@ def test_adapter_info_validation_partial_failed(mocker: MockerFixture) -> None:

assert (
e.value.message
== """> Adapter: name\n\n**⚠️ 在发布检查过程中,我们发现以下问题:**\n<pre><code><li>⚠️ 项目 <a href="https://www.baidu.com">主页</a> 返回状态码 404。<dt>请确保您的项目主页可访问。</dt></li></code></pre>\n<details><summary>测试详情</summary><pre><code><li>✅ 标签: test-#ffffff</li><li>✅ 包 <a href="https://pypi.org/project/project_link/">project_link</a> 已发布至 PyPI</li></code></pre></details>"""
== """> Adapter: name\n\n**⚠️ 在发布检查过程中,我们发现以下问题:**\n<pre><code><li>⚠️ 项目 <a href="https://www.baidu.com">主页</a> 返回状态码 404。<dt>请确保您的项目主页可访问。</dt></li></code></pre>\n<details><summary>详情</summary><pre><code><li>✅ 标签: test-#ffffff</li><li>✅ 包 <a href="https://pypi.org/project/project_link/">project_link</a> 已发布至 PyPI</li></code></pre></details>"""
)

calls = [
Expand Down
2 changes: 1 addition & 1 deletion tests/models/test_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_bot_info_validation_success(mocker: MockerFixture) -> None:

assert (
info.validation_message
== """> Bot: name\n\n**✅ 所有测试通过,一切准备就绪!**\n\n<details><summary>测试详情</summary><pre><code><li>✅ 标签: test-#ffffff</li><li>✅ 项目 <a href="https://v2.nonebot.dev">主页</a> 返回状态码 200.</li></code></pre></details>"""
== """> Bot: name\n\n**✅ 所有测试通过,一切准备就绪!**\n\n<details><summary>详情</summary><pre><code><li>✅ 标签: test-#ffffff</li><li>✅ 项目 <a href="https://v2.nonebot.dev">主页</a> 返回状态码 200.</li></code></pre></details>"""
)

calls = [
Expand Down
4 changes: 2 additions & 2 deletions tests/models/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def test_plugin_info_validation_success(mocker: MockerFixture) -> None:

assert (
info.validation_message
== """> Plugin: name\n\n**✅ 所有测试通过,一切准备就绪!**\n\n<details><summary>测试详情</summary><pre><code><li>✅ 标签: test-#ffffff</li><li>✅ 项目 <a href="https://v2.nonebot.dev">主页</a> 返回状态码 200.</li><li>✅ 包 <a href="https://pypi.org/project/project_link/">project_link</a> 已发布至 PyPI</li></code></pre></details>"""
== """> Plugin: name\n\n**✅ 所有测试通过,一切准备就绪!**\n\n<details><summary>详情</summary><pre><code><li>✅ 标签: test-#ffffff</li><li>✅ 项目 <a href="https://v2.nonebot.dev">主页</a> 返回状态码 200.</li><li>✅ 包 <a href="https://pypi.org/project/project_link/">project_link</a> 已发布至 PyPI</li></code></pre></details>"""
)

calls = [
Expand Down Expand Up @@ -155,7 +155,7 @@ def test_plugin_info_validation_partial_failed(mocker: MockerFixture) -> None:

assert (
e.value.message
== """> Plugin: name\n\n**⚠️ 在发布检查过程中,我们发现以下问题:**\n<pre><code><li>⚠️ 项目 <a href="https://www.baidu.com">主页</a> 返回状态码 404。<dt>请确保您的项目主页可访问。</dt></li></code></pre>\n<details><summary>测试详情</summary><pre><code><li>✅ 标签: test-#ffffff</li><li>✅ 包 <a href="https://pypi.org/project/project_link/">project_link</a> 已发布至 PyPI</li></code></pre></details>"""
== """> Plugin: name\n\n**⚠️ 在发布检查过程中,我们发现以下问题:**\n<pre><code><li>⚠️ 项目 <a href="https://www.baidu.com">主页</a> 返回状态码 404。<dt>请确保您的项目主页可访问。</dt></li></code></pre>\n<details><summary>详情</summary><pre><code><li>✅ 标签: test-#ffffff</li><li>✅ 包 <a href="https://pypi.org/project/project_link/">project_link</a> 已发布至 PyPI</li></code></pre></details>"""
)
calls = [
mocker.call("https://pypi.org/pypi/project_link/json"),
Expand Down
2 changes: 1 addition & 1 deletion tests/process/test_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,5 @@ def test_process_issues(mocker: MockerFixture, tmp_path: Path) -> None:

# 检查是否创建了评论
mock_repo.get_issue().create_comment.assert_called_with(
"""# 📃 商店发布检查结果\n\n> Bot: test\n\n**✅ 所有测试通过,一切准备就绪!**\n\n<details><summary>测试详情</summary><pre><code><li>✅ 标签: test-#ffffff</li><li>✅ 项目 <a href="https://v2.nonebot.dev">主页</a> 返回状态码 200.</li></code></pre></details>\n\n---\n\n💪 Powered by NoneBot2 Publish Bot\n"""
"""# 📃 商店发布检查结果\n\n> Bot: test\n\n**✅ 所有测试通过,一切准备就绪!**\n\n<details><summary>详情</summary><pre><code><li>✅ 标签: test-#ffffff</li><li>✅ 项目 <a href="https://v2.nonebot.dev">主页</a> 返回状态码 200.</li></code></pre></details>\n\n---\n\n💪 Powered by NoneBot2 Publish Bot\n"""
)

0 comments on commit 2a95585

Please sign in to comment.