Document about the ways to write unit tests for Bolt apps
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- python
- Lĩnh vực
- documentation, testing-qa
Hướng nghiên cứu
Bắt đầu với tài liệu Bolt for Python tại https://slack.dev/bolt-python/ và xem lại cấu trúc handler được trình bày trong main.py và api.py, bao gồm app.command, app.event, app.db, ack và respond. Ghi lại một phương pháp hợp lý để unit test các handler này, bao gồm test double cho các đối số của handler và các dependency của app, cùng với các ví dụ làm rõ hành vi mong đợi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I am looking to write unit tests for my Bolt API, which consists of an app with several handlers for events / messages. The handlers are both decorated using the app.event decorator, and make use of the app object to access things like the db connection that has been put on it. For example:
# in main.py
app = App(
token=APP_TOKEN,
signing_secret=SIGNING_SECRET,
process_before_response=True,
token_verification_enabled=token_verification_enabled,
)
app.db = db
# in api.py:
from .main import app
@app.command("/slashcommand")
def slash_command(ack, respond):
ack()
results = app.db.do_query()
respond(...)
The thing is, I cannot find any framework pointers, or documentation, on how I would write reasonable unit tests for this. Presumably ones where the kwargs like ack and respond are replaced by test doubles. How do I do this?
The page URLs
Requirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
- Ngôn ngữ chính
- Python
- Star
- 1.3k
- Fork
- 288
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 10
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của slackapi/bolt-python
-
docs enhancement server-side
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
slackapi/bolt-python#1576 · 1 bình luận ·
-
auto-triage-skip bug security semver:major
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
slackapi/bolt-python#1447 · 9 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
slackapi/bolt-python#1577 ·
-
area:async auto-triage-skip dependencies
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
slackapi/bolt-python#1472 · 1 bình luận · 1 reaction ·
-
auto-triage-skip enhancement
slackapi/bolt-python#1346 · 2 bình luận · 1 người được giao ·
Tất cả issue của slackapi/bolt-python
Issue tương tự
-
essnmx good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
-
[Feature] 奇物选择添加优先级 Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
syfoud/Simulated_Scepter#174 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Giskard-AI/giskard-oss#2840 · 1 bình luận ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Đang mởarea: repo bug perceived difficulty: 2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
yeti-platform/yeti#1380 ·