Document about the ways to write unit tests for Bolt apps
Nessuno ha ancora preso questa issue.
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
- 288
- Merge medio
- 1g 8h
- PR unite (30g)
- 10
Guida per i contributori
Apri 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
-
docs enhancement server-side
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
slackapi/bolt-python#1576 · 1 commento ·
-
auto-triage-skip bug security semver:major
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
slackapi/bolt-python#1447 · 9 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
slackapi/bolt-python#1577 ·
-
area:async auto-triage-skip dependencies
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
slackapi/bolt-python#1472 · 1 commento · 1 reazione ·
-
auto-triage-skip enhancement
slackapi/bolt-python#1346 · 2 commenti · 1 assegnatario ·
Tutte le issue di slackapi/bolt-python
Issue simili
-
essnmx good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
-
[Feature] 奇物选择添加优先级 Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Giskard-AI/giskard-oss#2840 · 1 commento ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Apertaarea: repo bug perceived difficulty: 2
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
yeti-platform/yeti#1380 ·