Skip to content

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

@nathanielrindlaub

Description

@nathanielrindlaub

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
        ...

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions