MDL-31356
Fixes for test suite.
Fix to course update routines so it doesn't muck with DB directly.