Replies: 2 comments
-
Is it possible for example to extend the imapclient.testable_imapclient to allow for the building of a 'fake' email inbox - similar to how one might use the pyfakefs to build a faked file system for testing purposes. I will have a go myself with a fork - but is this something the developers would be interested in ? |
Beta Was this translation helpful? Give feedback.
-
You could fake an email account by monkeypatching the required IMAPClient methods (e.g. In fact, you could implement a completely fake class for testing that has it's own implementation of the IMAPClient methods your email client uses. This could then simulate a mailbox with some messages in it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Fellow developers,
I am considering writing a thin email client (to display/filter emails) using ImapClient to connect to our Gmail Account - the reasons for not using IMapClient directly is to do with the custom filtering and sub-account support i want to add.
Part of our email client will necessitate filtering the emails based on sender or receiver address, and i think it would be beneficial if i could ensure that the filtering worked on actual email content (or at least mocked email content).
I know that your ImapClient testing uses a mocked imaplib to ensure that your client is making the right calls, but i need something more in depth i think.
Is there a way to extend your mocked imaplib so that it can provide 'mocked emails' - so my tests can add emails to the inbox with appropriate senders etc, and the mocked imaplib will return that email set when requested.
I am a bit of newbie when it comes to using mock but i assume such a thing is possible.
Yours,
Tony F.
Beta Was this translation helpful? Give feedback.
All reactions