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

Review Request #10509 — Created April 4, 2019 and submitted

Information

Review Board
release-4.0.x

Reviewers

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.

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

Summary ID
Improve type safety, unit test coverage, and usage of crypto routines.
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.
82776a365bc81b23416eccdba68858d764d9a2e4
Description From Last Updated

E501 line too long (80 > 79 characters)

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-4.0.x (3880a2c)