jainamoswal · GitHub

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.

Read the original on github.com ↗