OrBin / gramhopper

A rule-based Telegram bot engine, no coding required
https://pypi.org/project/gramhopper/
MIT License
3 stars 1 forks source link

End-to-end tests #57

Open OrBin opened 5 years ago

OrBin commented 5 years ago

Note: This is a follow-up task for #10.

We should create end-to-end tests for gramhopper.

The flow will be a creation of CombinedConversationHandler and/or CombinedMessageHandler, with mocked parts. The idea is mocking the bot parameter/object, in order to log the responses so they can be tested. For the mock, we probably should inherit CombinedMessageHandler, because it inherits MessageHandler and uses MessageHandler.handle_update() to call the updates-handling callback with the bot parameter. Maybe the dispatcher has to be mocked/inherited too.

We haven't yet thought about how to deeply mock incoming updates/messages - maybe we would like to override the function (I don't know which one it is) that checks for incoming updates and handles them (I guess it's in one of Update or Dispatcher classes).

We will begin with reading and parsing the configuration, through generating test messages to trigger the triggers, and checking the responded messages in the end.