Skip to content

Added .delete() shortcut for business messages #4869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jainamoswal
Copy link
Contributor

@jainamoswal jainamoswal commented Jul 19, 2025

closes #4867

@Bibo-Joshi
Copy link
Member

Hi @jainamoswal may I ask what's your status here? do you need help with anything?

@jainamoswal
Copy link
Contributor Author

I'm still figuring out about adding the tests regarding the code I added. @Bibo-Joshi

@aelkheir
Copy link
Member

So there are a couple of things we'd want to test here.

  • that calling message.delete actually calls the correct bot method depending on message.business_connection_id
  • that we correctly wrap message.id in a list; in the case that business_connection_id is present.
  • finally, test that the shortcut signature matches the bot's one, and correctly passes the shortcut'ed parameters.

The way i'd approach this is to monkeypatch one level higher than the bot methods. (i.e request.post for example). you can have a look at test_business_methods.py for examples on monkeypatch.

Then we'd also need to have two test message objects, possibly as a parameterized fixture, you can also search the codebase or pytest docs for those. once that is done, we can modify the test behavior and expectations based on the type of the message.

shoot me any questions if some parts aren't clear.

@Bibo-Joshi
Copy link
Member

@jainamoswal are you still interested in working on this? Do you need additional support with the tests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.delete() method doesn't work on business messages.
3 participants