Fix Python 3 compatibility when sending messages to Slack or Mattermost.
Review Request #11665 — Created June 20, 2021 and submitted — Latest diff uploaded
The code in Slack (which Mattermost uses as well) to send messages had a
string type problem. A Unicode string was being passed as the payload
urlopen(), which wasn't valid on Python 3. While the exception
was caught, it meant that no messages could be sent to either service.
This change fixes the string type, and updates all the relevant unit
tests to perform checks on the string types, headers, and payload
The unit test updates also simplify the tests, introducing common
utility functions to each suite that performs all the common tests.
Unit tests pass on Python 2 and 3.