Commit
- Loading branch information
There are no files selected for viewing
7 comments
on commit 50904f2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no tests? 😏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it and it fixed the bug ;) ideas how to unit test this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dunno exactly. I'd look at mocking whatever requests calls and add a side effect that throws SSLError (or whatever it is)? I was half joking, but for regressions it might be a good test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh no, I definitely thought of it but I don't know how to cause a "side effect" that would throw an SSLError without making a network connection?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
something like...
_get = mock.Mock()
_get.side_effect = requests.exceptions.SSLError
_requests = mock.Mock() # This would be via the decorator probably.
_requests.get = _get
Then call your method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just add a test that makes sure verify=False
is passed in to a mock. That way when code gets refactored around you won't forget that it needs to be False. Fudge is great for this :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be great to add a comment here so that someone doesn't "fix" the code when reading it.