Fix Python 3 compatibility when sending messages to Slack or Mattermost.

Review Request #11665 — Created June 20, 2021 and submitted

Information

rbintegrations
release-2.0.x

Reviewers

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
body to 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
contents.

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.

Summary ID
Fix Python 3 compatibility when sending messages to Slack or Mattermost.
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 body to `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 contents. The unit test updates also simplify the tests, introducing common utility functions to each suite that performs all the common tests.
8de9a188ff04a0e3f471c5fc8ccb3fe5e0570f21
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.0.x (d4cab79)
Loading...