Improve type safety, unit test coverage, and usage of crypto routines.

Review Request #1659 — Created May 15, 2019 and updated — Latest diff uploaded

guest7537
Review Board
3880a2c...
demo
guest7011, guest7015
This adds and improves the string type checks for the crypto and SSH
functions, ensuring we catch invalid input before hitting a cryptic
error message. It also fixes a couple of compatibility issues with
Python 3, involving division and an improper decode on a Unicode string.

The bulk of the change improves test coverage of these functions,
ensuring that all the types match what we expect. As part of this, the
method used to generate SSH keys for the tests have changed to create
stable keys for testing (so we can ensure that fingerprints don't change
across test runs) and to do so in a way that ensures we only load the
keys on first use, reusing them for any future tests.

Testing Done:
Unit tests pass on Python 2.7/Django 1.6 and Python 3.7/Django 1.11
(with other in-progress changes).

Reviewed at https://reviews.reviewboard.org/r/10509/

The code is perfect.

Loading...