Jsa/tnl549

recreated this PR from https://github.com/edx/edx-platform/pull/5559, to base on rc instead.

fixes TNL-549.

there's a dependency on https://github.com/edx/edx-platform/pull/5554 which is not yet merged but addresses a related bug, TNL-606.   There's a workaround condition in one of the tests, which should be removed in whichever PR merges last.

@andy-armstrong @polesye @jmclaus 
@benpatterson FYI