About
This package allows you to test you discord bot's commands without having to run the bot itself. It is made to be a drop-in library to be used with unittest or pytest.
Installation
pip install interactions-unittest
Usage
import unittest
import interactions
import interactions_unittest as itest
@interactions.SlashCommand(
name="ping",
description="Replies with pong",
options=[
interactions.Option(
name="extra",
description="extra text",
type=interactions.OptionType.STRING,
required=False
)
]
)
async def ping(ctx: interactions.SlashContext, extra: str = None):
await ctx.send(f"Pong! {extra}")
class TestPing(unittest.IsolatedAsyncioTestCase):
async def test_ping(self):
actions = await itest.call_slash(ping, extra="extra text")
self.assertTrue(actions[0]["action"] == "send")
self.assertTrue(actions[0]["message"]["content"] == "Pong! extra text")
Documentation
The call_slash method allows you to call a slash command with arguments, it will return a list of action dicts.
Each action dict has the following keys:
action: The action that was performed, ex:send,edit,delete,defermessage: The message that was sent, edited or deleted
Features
- context.edit message
- context.delete message
- context.send message
- context.defer
- message.delete
- message.edit
- message.reply
- message.react
- extensions
Metadata
Release files for interactions-unittest 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| interactions_unittest-1.0.3.tar.gz | 17.3 kB | Without provenance | Details for interactions_unittest-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| interactions_unittest-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for interactions_unittest-1.0.3-py3-none-any.whl |
Total release size: 34.7 kB
Release files / interactions_unittest-1.0.3.tar.gz
| Download URL | interactions_unittest-1.0.3.tar.gz |
|---|---|
| Size | 17.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
98d73093534f93653b8823f3786e3faea1c130a93fac1c3461d7452e3610326a
|
|
BLAKE2b-256 checksum How to use checksums |
2467d25962080f4685548441211edc83e618f45aa9921ae2d7683ce82e1a803f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.6
|
Release files / interactions_unittest-1.0.3-py3-none-any.whl
| Download URL | interactions_unittest-1.0.3-py3-none-any.whl |
|---|---|
| Size | 17.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c2415a8e087869583a64f5dafd02cb55a9af5b9ca7fb1ee83ae730e05aaf1473
|
|
BLAKE2b-256 checksum How to use checksums |
cc5766532520671e14fd7c6001adf419c50071c329f0c9b949e4297ba29f4b52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.6
|
Security for interactions-unittest 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.