Skip to content
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

Clarity on use of examples.py in unit tests #19

Open
nathanielrindlaub opened this issue Jun 17, 2023 · 0 comments
Open

Clarity on use of examples.py in unit tests #19

nathanielrindlaub opened this issue Jun 17, 2023 · 0 comments
Assignees

Comments

@nathanielrindlaub
Copy link
Member

Hey @postfalk - I think this would be probably easier to discuss on a call but just putting it here while my thoughts are fresh.

I started attempting to implement CuddeBack tests in tests_cameras.py, following the patterns you had laid out for the RidgeTecs, but quickly realized it would be easier to read in the real CuddeLink email file as the example for testing rather than attempting to mock the email & attached image in the tests/examples.py file. That seemed to work fine, but I started looking around some of the other test files (test_handler.py and test_helpers.py, for example), and noticed you were already doing that to test getting the email and saving attached images - so that was a bit confusing (why aren't all tests using tests/examples.py). In some cases, e.g. in test_handler_ridgetec, you're half creating a new mocked email right in the test and half using the mocked ridgetec email defined in examples.py):

    ...
    def test_handler_ridgetec(self, upload_file, download_img, get_email):
        fake_message = email.message.EmailMessage()
        fake_message['From'] = 'A message from ridgetec'
        fake_message['Body'] = examples.RIDGETEC_EMAIL_BODY
        get_email.return_value = fake_message
        ...
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

No branches or pull requests

2 participants