Improve testability for hosting service POST data.

Review Request #9869 — Created April 10, 2018 and submitted

Christian Hammond
Review Board

The code that generates form data payloads for HTTP POST requests for
hosting services resulted in payloads that weren't easy to test against.
The fields were listed in dictionary iteration order, which varied
between Python 2 and 3. We also didn't have a great place to spy on
the boundary generator, since mimetools.choose_boundary() is no more
on Python 3.

This change improves testability by wrapping
mimetools.choose_boundary(), giving us a stable function to spy on,
and by sorting the data going into the payload so it's more predictable.

Unit tests pass.

Tested this along with other upcoming changes that test these payloads.

David Trowbridge
  1. Ship It!
Christian Hammond
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-3.0.x (8ea9ecb)