Document about the ways to write unit tests for Bolt apps
I maintainer di solito rispondono entro 1 giorno
@Mohith26 ci sta già lavorando.
Dal 4/11/2026.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Documentazione
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- python
- Ambito
- documentation, testing-qa
Direzione di ricerca
Inizia dalla documentazione di Bolt for Python all’indirizzo https://slack.dev/bolt-python/ e rivedi la struttura degli handler mostrata in main.py e api.py, inclusi app.command, app.event, app.db, ack e respond. Documenta un approccio ragionevole per i test unitari di questi handler, inclusi i test double per gli argomenti degli handler e le dipendenze di app, con esempi che rendano chiaro il comportamento previsto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 1.3k
- Fork
- 300
- Merge medio
- 19h 33m
- PR unite (30g)
- 25
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di slackapi/bolt-python
-
`extract_team_id` crashes with `TypeError when payload["user"]` is a string (e.g. `member_joined_channel` events)Forse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaauto-triage-skip bug security semver:major
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
slackapi/bolt-python#1447 · 9 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
auto-triage-stale
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
slackapi/bolt-python#1599 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Error handlers that take args: Args crash with a missing 'next' argumentForse già presa @sahiljagtap08 l’ha presa 42 giorni fa. Apertaauto-triage-stale
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
slackapi/bolt-python#1598 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Assistant listener middleware crashes when given a plain functionForse già presa @sahiljagtap08 l’ha presa 42 giorni fa. Apertaauto-triage-stale
Difficoltà 2/5 1-3 ore Idoneità per principianti 30/100
slackapi/bolt-python#1597 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
AsyncOAuthFlow raises UnboundLocalError on org-wide install without a bot tokenForse già presa @sahiljagtap08 l’ha presa 42 giorni fa. Apertaauto-triage-stale
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
slackapi/bolt-python#1596 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di slackapi/bolt-python
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
trycua/hermes-cua-spaces#17 ·
-
area:codegen backend:hip bug direction:output good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
status:waiting-for-triage type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
microsoftgraph/msgraph-sdk-python#1628 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
nautechsystems/nautilus_trader#5718 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: reme CLI crashes when the running server used a relative config pathForse già presa @nurlanmnn l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
agentscope-ai/ReMe#770 ·
I maintainer di solito rispondono entro 1 giorno